One: python format checker yapf seems to work differently with 0.22.0

Created on 4 Jun 2020  路  11Comments  路  Source: Samsung/ONE

I installed yapf yesterday again with yapf==0.22.

$ yapf --version
yapf 0.22.0

However, it seems work differently in our CI's yapf. It touches some python file. For example,

$ git diff
diff --git a/compiler/nnc/utils/caffe_model_maker/GenerateCaffeModels.py b/compiler/nnc/utils/caffe_model_maker/GenerateCaffeModels.py
index df11d63..ca8b377 100755
--- a/compiler/nnc/utils/caffe_model_maker/GenerateCaffeModels.py
+++ b/compiler/nnc/utils/caffe_model_maker/GenerateCaffeModels.py
@@ -680,9 +680,10 @@ class Layer:
                 net.data1 = L.DummyData(
                     data_filler=cofil, shape={'dim': self.special_shape})

-            net.op = getattr(L, self.name)(net.data, *[
-                getattr(net, "data" + str(i)) for i in range(1, self.num_inp)
-            ], **self.args)
+            net.op = getattr(L, self.name)(
+                net.data,
+                *[getattr(net, "data" + str(i))
+                  for i in range(1, self.num_inp)], **self.args)

         if self.is_notop:
             net.op.fn.tops = OrderedDict()

Does anyone have same problem?

help wanted

Most helpful comment

Sergei's solution of the problem: #1863
:smiley:

All 11 comments

Does anyone have same problem?

Yes. I also have similar issue with clang-format.

@glistening
Could you list the other files that are touched by the tool?

I've found an issue is written on Mar 25, 2019, in yapf repository. Maybe, I have to skip python test when I don't touch python.

$ CHECK_PYTHON=0 ./nnas format

What files are affected?
Maybe we should just remove them?

File you provided as an example is long time abandoned, I am not even sure, how to use it =_=

GenerateCaffeModels.py is the only file that my yapf reports.

I tried to uninstall yapf and install yapf 0.22.0 again.
In my environment, format checker touch nothing.

hseok82:/home/nfs/git/ONE$ yapf --version
yapf 0.22.0
hseok82:/home/nfs/git/ONE$ pip uninstall yapf 
Found existing installation: yapf 0.22.0
Uninstalling yapf-0.22.0:
  Would remove:
    /home/hseok82/.local/bin/yapf
    /home/hseok82/.local/lib/python3.6/site-packages/yapf-0.22.0.dist-info/*
    /home/hseok82/.local/lib/python3.6/site-packages/yapf/*
    /home/hseok82/.local/lib/python3.6/site-packages/yapftests/*
Proceed (y/n)? y
  Successfully uninstalled yapf-0.22.0
hseok82:/home/nfs/git/ONE$ pip install yapf==0.22.0 --user
Looking in indexes: http://ftp.daumkakao.com/pypi/simple
Collecting yapf==0.22.0
  Downloading http://mirror.kakao.com/pypi/packages/d5/ae/9d2e8f43f2ce467991c8310e361bbf4f1e1bf32afc6441b4e3416685b7ef/yapf-0.22.0-py2.py3-none-any.whl (166 kB)
     |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 166 kB 172 kB/s 
Installing collected packages: yapf
Successfully installed yapf-0.22.0
hseok82:/home/nfs/git/ONE$ ./nnas format
[PASSED] Format checker succeed.

Sergei's solution of the problem: #1863
:smiley:

@s-barannikov, @binarman Wow! Thank you! :)

@hseok-oh It may be related to something outside that yapf depends. yapf issue says it works differently depending on python2 or python3. I've updated python 3.5.x to 3.7.7.

@glistening
FYI, file deleted

@binarman, @s-barannikov It works. Thank you again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucenticus picture lucenticus  路  3Comments

binarman picture binarman  路  3Comments

mhs4670go picture mhs4670go  路  3Comments

jinevening picture jinevening  路  3Comments

mhs4670go picture mhs4670go  路  3Comments