Hi, I'm try to refactoring code style.
In PR https://github.com/RaRe-Technologies/gensim/pull/1550
piskvorky 22 hours ago • edited Owner
-1: we don't want to litter the code with some tool-specific constructs.Instead, open an issue with the tool that requires this, it's a bug on their side if they cannot handle this line.
If you find such comments in other parts of gensim, please remove them too.
Same case in sklearn_api/__init__.py
ex ) from .ldamodel import LdaTransformer # noqa: F401
For solve F401 error, add noqa comments or add __all__ list in __init__.py file.( pyflake issue , stackoverflow question )
Which is better in both cases?
Thanks for digging into this! That pyflake issue really explains it well.
It still looks like a bug in pyflake to me. We could add __all__ (it's better than the weird # noqa comment), but it's still extra code for no reason, so I'm not very thrilled about it. Unnecessary chance to forget to add something there in the future and add more maintenance. @menshikh-iv thoughts?
So, for my opinion, noqa is OK.
We can also add __all__ directive, but we should "duplicate" import each time in init (I means we should do 2 things: import somestuff and add somestuff to __all__)
@piskvorky @menshikh-iv
PR https://github.com/RaRe-Technologies/gensim/pull/1550
+# flake8: noqa
piskvorky 4 days ago Owner
This seems to combine the worst of both worlds. Still extra comments, AND no style checking.
I think I prefer even the noqa:F401 version.
How about ignore F401 error for the __init__.py file in flake8_diff.sh?
In else block, if __init__.py then add F401 on ignore options, otherwise execute original command
Also, If think that noqa is still the better option, I want to close this issue.
Alright, let's use the noqa.
@zsef123 agree with @piskvorky, let's use noqa explicitly.
Most helpful comment
@piskvorky @menshikh-iv
PR https://github.com/RaRe-Technologies/gensim/pull/1550
+# flake8: noqaHow about ignore F401 error for the
__init__.pyfile in flake8_diff.sh?In
elseblock, if__init__.pythen add F401 on ignore options, otherwise execute original commandAlso, If think that noqa is still the better option, I want to close this issue.