Closed eggplants closed 2 years ago
That is odd. The example file works for me on Linux, so something is different on our setups. What version of flake8 etc do you have? i.e. What do these commands report:
$ black --version
black, version 20.8b1
$ flake8 --version
3.9.1 (black: 0.2.4, flake8-blind-except: 0.2.0, flake8-bugbear: 20.11.1,
mccabe: 0.6.1, pycodestyle: 2.7.0, pyflakes: 2.3.1, rst-docstrings: 0.2.5)
CPython 3.7.9 on Linux
I updated black, flake8 and the plugins, and it still works for me:
$ black --version
black, 22.1.0 (compiled: yes)
$ flake8 --version
4.0.1 (black: 0.2.4, flake8-blind-except: 0.2.0, flake8-bugbear: 22.1.11,
mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0, rst-docstrings: 0.2.5)
CPython 3.7.9 on Linux
There you go.
$ uname --vorm
21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64 Darwin
$ python -V
Python 3.9.9
$ black --version
black, 22.1.0 (compiled: yes)
$ flake8 --version
4.0.1 (black: 0.2.3, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.9.9 on Darwin
Thanks. I see three differences, Linux vs macOS, Python 3.7.9 vs 3.9.9, and extra plugins. I uninstalled the extra plugins, that made no difference. I can try macOS and Python 3.9.9 next... (although not immediately, not sitting at the right machine).
Good news - I saw it break on macOS with flake8-black v0.2.3
I see what is was now, a duplicate of #44. Please update to flake8-black v0.2.4, and let me know if that fixes it.
Fixed! Thank you!
The problem I reported some time ago seems to be recurring in flake8-black 0.3.2.
ref: https://github.com/RDFLib/rdflib/pull/1763#issuecomment-1068502380
Oh. That's flake8-black 0.3.2, presumably Linux, but can you confirm the version of black?
This is on macOS - looks fine:
$ chmod a+x test.py
$ cat test.py
#!/usr/bin/env python3
$ black --version
black, 22.1.0 (compiled: yes)
$ flake8 --version
4.0.1 (black: 0.3.2, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.5 on Darwin
$ black --diff --check test.py
All done! ✨ 🍰 ✨
1 file would be left unchanged.
$ flake8 test.py
This in on Linux, also looks fine:
$ chmod a+x test.py
$ cat test.py
#!/usr/bin/env python3
$ black --version
flakblack, 22.1.0 (compiled: yes)
$ flake8 --version
4.0.1 (black: 0.3.2, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0)
CPython 3.7.9 on Linux
$ black --diff --check test.py
All done! ✨ 🍰 ✨
1 file would be left unchanged.
$ flake8 test.py
Here is the log:
https://github.com/RDFLib/rdflib/actions/runs/1989410120
$ pip install --default-timeout 60 -r requirements.dev.txt
...
Successfully installed MarkupSafe-2.1.1 Pygments-2.11.2 alabaster-0.7.12 attrs-21.4.0 babel-2.9.1 black-22.1.0 certifi-2021.10.8 charset-normalizer-2.0.12 click-8.0.4 coverage-6.3.2 doctest-ignore-unicode-0.1.2 docutils-0.17.1 flake8-4.0.1 flake8-black-0.3.2 idna-3.3 imagesize-1.3.0 importlib-metadata-4.2.0 iniconfig-1.1.1 isort-5.10.1 jinja2-3.0.3 markdown-it-py-2.0.1 mccabe-0.6.1 mdit-py-plugins-0.3.0 mdurl-0.1.0 mypy-0.941 mypy-extensions-0.4.3 myst-parser-0.17.0 nose-1.3.7 packaging-21.3 pathspec-0.9.0 pbr-5.8.1 platformdirs-2.5.1 pluggy-1.0.0 py-1.11.0 pycodestyle-2.8.0 pyflakes-2.4.0 pytest-7.1.0 pytest-cov-3.0.0 pytest-subtests-0.7.0 pytz-2021.3 pyyaml-6.0 requests-2.27.1 snowballstemmer-2.2.0 sphinx-4.3.2 sphinxcontrib-apidoc-0.3.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-2.0.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-kroki-1.3.0 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.5 tomli-2.0.1 typed-ast-1.5.2 types-setuptools-57.4.10 typing-extensions-4.1.1 urllib3-1.26.8 zipp-3.7.0
...
$ flake8 --exit-zero rdflib
rdflib/collection.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/store.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/graph.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/graph.py:16:1: F401 'warnings.warn' imported but unused
rdflib/graph.py:19:1: F401 'rdflib.namespace' imported but unused
rdflib/graph.py:1011:[28](https://github.com/RDFLib/rdflib/runs/5561399664?check_suite_focus=true#step:10:28): F811 redefinition of unused 'namespace' from line 19
rdflib/graph.py:1028:21: F402 import 'namespace' from line 19 shadowed by loop variable
rdflib/graph.py:2[35](https://github.com/RDFLib/rdflib/runs/5561399664?check_suite_focus=true#step:10:35)1:28: F811 redefinition of unused 'namespace' from line 19
rdflib/graph.py:2356:25: F402 import 'namespace' from line 19 shadowed by loop variable
rdflib/plugin.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/parser.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/exceptions.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/paths.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/compare.py:0:1: BLK999 Unexpected exception: int object expected; got str
rdflib/compare.py:[36](https://github.com/RDFLib/rdflib/runs/5561399664?check_suite_focus=true#step:10:36)9:76: E203 whitespace before ':'
rdflib/compat.py:0:1: BLK999 Unexpected exception: int object expected; got str
...
Hmm, BLK999 Unexpected exception: int object expected; got str
looks new to me?
There is nothing obvious in the versions of the key tools, I guess next I should try pip install -r requirements.dev.txt
and see what happens. Unlikely, but it could be a bad interaction with another tool perhaps?
Unlikely, but it could be a bad interaction with another tool perhaps? I think so too. I'll investigate it later.
Thank you for your support.
I had a go with all those libraries installed (macOS Python 3.8.5), could not reproduce this.