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

Spurious F811 redefinition of error with flake8 6.1.0 #1855

Closed
oscarbenjamin opened this issue Jul 30, 2023 · 1 comment
Closed

Spurious F811 redefinition of error with flake8 6.1.0 #1855

oscarbenjamin opened this issue Jul 30, 2023 · 1 comment

Comments

@oscarbenjamin
Copy link

how did you install flake8?

$ pip install flake8

unmodified output of flake8 --bug-report

$ flake8 --bug-report
{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.11.3",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

The latest release of flake8 leads to this error on the SymPy codebase:

$ flake8 sympy/parsing/latex/_parse_latex_antlr.py 
sympy/parsing/latex/_parse_latex_antlr.py:31:5: F811 redefinition of unused 'MathErrorListener' from line 13

The code complained about can be seen here:
https://github.com/sympy/sympy/blob/f007dac3f2a1f700175651b942aaeb7bb26fc99c/sympy/parsing/latex/_parse_latex_antlr.py#L13-L31

The class is being defined conditionally based on whether modules are available to import and is set to None by default otherwise. There is no reason that flake8 should complain about this.

Something has changed in the latest release to cause this because previous versions of flake8 did not complain e.g. with flake8==6.0.0 the same code passes fine.

@asottile
Copy link
Member

please read the template and the issue prompts

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