Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLK999 for shebang #47

Closed
eggplants opened this issue Feb 3, 2022 · 12 comments
Closed

BLK999 for shebang #47

eggplants opened this issue Feb 3, 2022 · 12 comments

Comments

@eggplants
Copy link
Contributor

$ cat test.py
#!/usr/bin/env python3

print("test")
$ flake8 -v test.py
flake8.plugins.manager    MainProcess     49 INFO     Loading entry-points for "flake8.extension".
flake8.plugins.manager    MainProcess     76 INFO     Loading entry-points for "flake8.report".
flake8.plugins.manager    MainProcess    103 INFO     Loading plugin "BLK" from entry-point.
flake8.plugins.manager    MainProcess    162 INFO     Loading plugin "C90" from entry-point.
flake8.plugins.manager    MainProcess    164 INFO     Loading plugin "F" from entry-point.
flake8.plugins.manager    MainProcess    175 INFO     Loading plugin "pycodestyle.ambiguous_identifier" from entry-point.
flake8.plugins.manager    MainProcess    179 INFO     Loading plugin "pycodestyle.bare_except" from entry-point.
flake8.plugins.manager    MainProcess    179 INFO     Loading plugin "pycodestyle.blank_lines" from entry-point.
flake8.plugins.manager    MainProcess    179 INFO     Loading plugin "pycodestyle.break_after_binary_operator" from entry-point.
flake8.plugins.manager    MainProcess    179 INFO     Loading plugin "pycodestyle.break_before_binary_operator" from entry-point.
flake8.plugins.manager    MainProcess    179 INFO     Loading plugin "pycodestyle.comparison_negative" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.comparison_to_singleton" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.comparison_type" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.compound_statements" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.continued_indentation" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.explicit_line_join" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.extraneous_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.imports_on_separate_lines" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.indentation" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.maximum_doc_length" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.maximum_line_length" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.missing_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.missing_whitespace_after_import_keyword" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.missing_whitespace_around_operator" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.module_imports_on_top_of_file" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_async_await_keywords" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_backticks" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_has_key" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_invalid_escape_sequence" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_not_equal" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.python_3000_raise_comma" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.tabs_obsolete" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.tabs_or_spaces" from entry-point.
flake8.plugins.manager    MainProcess    180 INFO     Loading plugin "pycodestyle.trailing_blank_lines" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.trailing_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_around_comma" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_around_keywords" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_around_named_parameter_equals" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_around_operator" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_before_comment" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pycodestyle.whitespace_before_parameters" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "default" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "pylint" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "quiet-filename" from entry-point.
flake8.plugins.manager    MainProcess    181 INFO     Loading plugin "quiet-nothing" from entry-point.
flake8.options.manager    MainProcess    181 WARNING  option --max-complexity: please update from optparse string `type=` to argparse callable `type=` -- this will be an error in the future
flake8                    MainProcess    182 INFO     flake8-black: No black configuration set
flake8.checker            MainProcess    183 WARNING  The multiprocessing module is not available. Ignoring --jobs arguments.
flake8.checker            MainProcess    183 INFO     Making checkers
flake8.checker            MainProcess    184 INFO     Checking 1 files
flake8.main.application   MainProcess    189 INFO     Finished running
flake8.main.application   MainProcess    189 INFO     Reporting errors
flake8.main.application   MainProcess    189 INFO     Found a total of 1 violations and reported 1
_.py:0:1: BLK999 Unexpected exception: unsupported operand type(s) for /: 'tuple' and 'str'
@peterjc
Copy link
Owner

peterjc commented Feb 3, 2022

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

@eggplants
Copy link
Contributor Author

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

@peterjc
Copy link
Owner

peterjc commented Feb 3, 2022

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).

@peterjc
Copy link
Owner

peterjc commented Feb 3, 2022

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.

@eggplants
Copy link
Contributor Author

Fixed! Thank you!

@eggplants
Copy link
Contributor Author

The problem I reported some time ago seems to be recurring in flake8-black 0.3.2.

ref: RDFLib/rdflib#1763 (comment)

@peterjc
Copy link
Owner

peterjc commented Mar 16, 2022

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

@eggplants
Copy link
Contributor Author

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
...

@peterjc
Copy link
Owner

peterjc commented Mar 16, 2022

Hmm, BLK999 Unexpected exception: int object expected; got str looks new to me?

@peterjc
Copy link
Owner

peterjc commented Mar 16, 2022

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?

@eggplants
Copy link
Contributor Author

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.

@peterjc
Copy link
Owner

peterjc commented Mar 17, 2022

I had a go with all those libraries installed (macOS Python 3.8.5), could not reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants