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

AttributeError: 'Raise' object has no attribute 'value' #2341

Closed
orsinium opened this issue Jan 28, 2022 · 4 comments
Closed

AttributeError: 'Raise' object has no attribute 'value' #2341

orsinium opened this issue Jan 28, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@orsinium
Copy link
Collaborator

What's wrong

Traceback (most recent call last):
  File "site-packages/wemake_python_styleguide/checker.py", line 154, in run
    visitor.run()
  File "site-packages/wemake_python_styleguide/visitors/base.py", line 191, in run
    self.visit(self.tree)
  File "site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "site-packages/wemake_python_styleguide/compat/routing.py", line 36, in route_visit
    return getattr(
  File "/usr/local/lib/python3.9/ast.py", line 415, in generic_visit
    self.visit(item)
  File "site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "site-packages/wemake_python_styleguide/compat/routing.py", line 36, in route_visit
    return getattr(
  File "/usr/local/lib/python3.9/ast.py", line 415, in generic_visit
    self.visit(item)
  File "site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "site-packages/wemake_python_styleguide/compat/routing.py", line 36, in route_visit
    return getattr(
  File "site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 28, in visit_any_function
    self._check_function_annotations_complexity(node)
  File "site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 46, in _check_function_annotations_complexity
    self._check_annotations_complexity(node, annotations)
  File "site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 55, in _check_annotations_complexity
    complexity = get_annotation_complexity(annotation)
  File "site-packages/wemake_python_styleguide/logic/complexity/annotations.py", line 38, in get_annotation_complexity
    return 1 + get_annotation_complexity(get_slice_expr(annotation_node))
  File "site-packages/wemake_python_styleguide/logic/complexity/annotations.py", line 40, in get_annotation_complexity
    return max(
  File "site-packages/wemake_python_styleguide/logic/complexity/annotations.py", line 41, in <genexpr>
    (get_annotation_complexity(node) for node in annotation_node.elts),
  File "site-packages/wemake_python_styleguide/logic/complexity/annotations.py", line 31, in get_annotation_complexity
    annotation_node = ast.parse(  # type: ignore
AttributeError: 'Raise' object has no attribute 'value'

How it should be

--

Flake8 version and plugins

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.0",
    "system": "Linux"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "flake8-bandit",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "flake8-broken-line",
      "version": "0.4.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-bugbear",
      "version": "21.11.29"
    },
    {
      "is_local": false,
      "plugin": "flake8-comprehensions",
      "version": "3.8.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-darglint",
      "version": "1.8.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-debugger",
      "version": "4.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-docstrings",
      "version": "1.6.0, pydocstyle: 6.1.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-eradicate",
      "version": "1.2.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-string-format",
      "version": "0.3.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_commas",
      "version": "2.1.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_isort",
      "version": "4.1.1"
    },
    {
      "is_local": false,
      "plugin": "flake8_quotes",
      "version": "3.3.1"
    },
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "naming",
      "version": "0.12.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.8.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.4.0"
    },
    {
      "is_local": false,
      "plugin": "rst-docstrings",
      "version": "0.2.5"
    },
    {
      "is_local": false,
      "plugin": "wemake_python_styleguide",
      "version": "0.16.0"
    }
  ],
  "version": "4.0.1"
}

pip information

astor==0.8.1
attrs==21.4.0
bandit==1.7.2
darglint==1.8.1
docutils==0.18.1
eradicate==2.0.0
flake8==4.0.1
flake8-bandit==2.1.2
flake8-broken-line==0.4.0
flake8-bugbear==21.11.29
flake8-codes==0.2.0
flake8-commas==2.1.0
flake8-comprehensions==3.8.0
flake8-debugger==4.0.0
flake8-docstrings==1.6.0
flake8-eradicate==1.2.0
flake8-isort==4.1.1
flake8-polyfill==1.0.2
flake8-quotes==3.3.1
flake8-rst-docstrings==0.2.5
flake8-string-format==0.3.0
GitPython==3.1.26
isort==5.10.1
mccabe==0.6.1
pbr==5.8.0
pep8-naming==0.12.1
pycodestyle==2.8.0
pydocstyle==6.1.1
pyflakes==2.4.0
Pygments==2.11.2
PyYAML==6.0
restructuredtext-lint==1.3.2
six==1.16.0
smmap==5.0.0
snowballstemmer==2.2.0
stevedore==3.5.0
testfixtures==6.18.3
typing_extensions==4.0.1
unify==0.5
untokenize==0.1.1
urllib3==1.26.8
wemake-python-styleguide==0.16.0

OS information

Linux rock 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@orsinium orsinium added the bug Something isn't working label Jan 28, 2022
@sobolevn
Copy link
Member

@orsinium can you please also show a code sample to reproduce this? 🤔

@orsinium
Copy link
Collaborator Author

I'll try. I was running it on the whole site-packages by accident when it happened, it's something there 👀

@orsinium
Copy link
Collaborator Author

@sobolevn
Copy link
Member

Thanks!

sobolevn added a commit that referenced this issue Jan 28, 2022
@sobolevn sobolevn added this to the Version 0.16.x milestone Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants