Skip to content

Commit

Permalink
Fix #2341 (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jan 29, 2022
1 parent 61d4fa5 commit c4414c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,13 @@ Semantic versioning in our case means:
change the client facing API, change code conventions significantly, etc.


## 0.16.1 WIP

### Bugfixes

- Fixes crash on `'Literal["raise"]'` annotation #2341


## 0.16.0

## Features
Expand Down
Expand Up @@ -16,6 +16,9 @@
('Literal[""]', 2),
('Tuple[()]', 2),
# Literals with strings:
('Literal["regular", "raise", "is"]', 2),
# invalid annotations
('"This is rainbow in the dark!"', 1),
Expand Down
2 changes: 1 addition & 1 deletion wemake_python_styleguide/logic/complexity/annotations.py
Expand Up @@ -31,7 +31,7 @@ def get_annotation_complexity(annotation_node: _Annotation) -> int:
annotation_node = ast.parse( # type: ignore
annotation_node.s,
).body[0].value
except (SyntaxError, IndexError):
except Exception:
return 1

if isinstance(annotation_node, ast.Subscript):
Expand Down

0 comments on commit c4414c8

Please sign in to comment.