We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Annotation complexity should not fail on expressions
# Bug report

This code:

```python
def some() -> 'test expression':
    ...
```

Makes `flake8-annotation-complexity` to fail. We need to ignore this case silently.

Related: #1170 

Demo: https://asciinema.org/a/IIjIfkVKytmZ1F5c2YufMORdi
Annotation complexity should not fail on expressions
# Bug report

This code:

```python
def some() -> 'test expression':
    ...
```

Makes `flake8-annotation-complexity` to fail. We need to ignore this case silently.

Related: #1170 

Demo: https://asciinema.org/a/IIjIfkVKytmZ1F5c2YufMORdi

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `wemake_python_styleguide/logic/complexity/annotations.py`
Content:
```
1 """
2 Counts annotation complexity by getting the nesting level of nodes.
3 
4 So ``List[int]`` complexity is 2
5 and ``Tuple[List[Optional[str]], int]`` is 4.
6 
7 Adapted from: https://github.com/best-doctor/flake8-annotations-complexity
8 """
9 
10 import ast
11 from typing import Union
12 
13 _Annotation = Union[
14     ast.expr,
15     ast.Str,
16 ]
17 
18 
19 def get_annotation_compexity(annotation_node: _Annotation) -> int:
20     """
21     Recursevly counts complexity of annotation nodes.
22 
23     When annotations are written as strings,
24     we additionally parse them to ``ast`` nodes.
25     """
26     if isinstance(annotation_node, ast.Str):
27         annotation_node = ast.parse(  # type: ignore
28             annotation_node.s,
29         ).body[0].value
30 
31     if isinstance(annotation_node, ast.Subscript):
32         return 1 + get_annotation_compexity(
33             annotation_node.slice.value,  # type: ignore
34         )
35     elif isinstance(annotation_node, (ast.Tuple, ast.List)):
36         return max(
37             (get_annotation_compexity(node) for node in annotation_node.elts),
38             default=1,
39         )
40     return 1
41
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/wemake_python_styleguide/logic/complexity/annotations.py b/wemake_python_styleguide/logic/complexity/annotations.py
--- a/wemake_python_styleguide/logic/complexity/annotations.py
+++ b/wemake_python_styleguide/logic/complexity/annotations.py
@@ -24,9 +24,12 @@
     we additionally parse them to ``ast`` nodes.
     """
     if isinstance(annotation_node, ast.Str):
-        annotation_node = ast.parse(  # type: ignore
-            annotation_node.s,
-        ).body[0].value
+        try:
+            annotation_node = ast.parse(  # type: ignore
+                annotation_node.s,
+            ).body[0].value
+        except SyntaxError:
+            return 1
 
     if isinstance(annotation_node, ast.Subscript):
         return 1 + get_annotation_compexity(

{"golden_diff": "diff --git a/wemake_python_styleguide/logic/complexity/annotations.py b/wemake_python_styleguide/logic/complexity/annotations.py\n--- a/wemake_python_styleguide/logic/complexity/annotations.py\n+++ b/wemake_python_styleguide/logic/complexity/annotations.py\n@@ -24,9 +24,12 @@\n     we additionally parse them to ``ast`` nodes.\n     \"\"\"\n     if isinstance(annotation_node, ast.Str):\n-        annotation_node = ast.parse(  # type: ignore\n-            annotation_node.s,\n-        ).body[0].value\n+        try:\n+            annotation_node = ast.parse(  # type: ignore\n+                annotation_node.s,\n+            ).body[0].value\n+        except SyntaxError:\n+            return 1\n \n     if isinstance(annotation_node, ast.Subscript):\n         return 1 + get_annotation_compexity(\n", "issue": "Annotation complexity should not fail on expressions\n# Bug report\r\n\r\nThis code:\r\n\r\n```python\r\ndef some() -> 'test expression':\r\n    ...\r\n```\r\n\r\nMakes `flake8-annotation-complexity` to fail. We need to ignore this case silently.\r\n\r\nRelated: #1170 \r\n\r\nDemo: https://asciinema.org/a/IIjIfkVKytmZ1F5c2YufMORdi\nAnnotation complexity should not fail on expressions\n# Bug report\r\n\r\nThis code:\r\n\r\n```python\r\ndef some() -> 'test expression':\r\n    ...\r\n```\r\n\r\nMakes `flake8-annotation-complexity` to fail. We need to ignore this case silently.\r\n\r\nRelated: #1170 \r\n\r\nDemo: https://asciinema.org/a/IIjIfkVKytmZ1F5c2YufMORdi\n", "before_files": [{"content": "\"\"\"\nCounts annotation complexity by getting the nesting level of nodes.\n\nSo ``List[int]`` complexity is 2\nand ``Tuple[List[Optional[str]], int]`` is 4.\n\nAdapted from: https://github.com/best-doctor/flake8-annotations-complexity\n\"\"\"\n\nimport ast\nfrom typing import Union\n\n_Annotation = Union[\n    ast.expr,\n    ast.Str,\n]\n\n\ndef get_annotation_compexity(annotation_node: _Annotation) -> int:\n    \"\"\"\n    Recursevly counts complexity of annotation nodes.\n\n    When annotations are written as strings,\n    we additionally parse them to ``ast`` nodes.\n    \"\"\"\n    if isinstance(annotation_node, ast.Str):\n        annotation_node = ast.parse(  # type: ignore\n            annotation_node.s,\n        ).body[0].value\n\n    if isinstance(annotation_node, ast.Subscript):\n        return 1 + get_annotation_compexity(\n            annotation_node.slice.value,  # type: ignore\n        )\n    elif isinstance(annotation_node, (ast.Tuple, ast.List)):\n        return max(\n            (get_annotation_compexity(node) for node in annotation_node.elts),\n            default=1,\n        )\n    return 1\n", "path": "wemake_python_styleguide/logic/complexity/annotations.py"}], "after_files": [{"content": "\"\"\"\nCounts annotation complexity by getting the nesting level of nodes.\n\nSo ``List[int]`` complexity is 2\nand ``Tuple[List[Optional[str]], int]`` is 4.\n\nAdapted from: https://github.com/best-doctor/flake8-annotations-complexity\n\"\"\"\n\nimport ast\nfrom typing import Union\n\n_Annotation = Union[\n    ast.expr,\n    ast.Str,\n]\n\n\ndef get_annotation_compexity(annotation_node: _Annotation) -> int:\n    \"\"\"\n    Recursevly counts complexity of annotation nodes.\n\n    When annotations are written as strings,\n    we additionally parse them to ``ast`` nodes.\n    \"\"\"\n    if isinstance(annotation_node, ast.Str):\n        try:\n            annotation_node = ast.parse(  # type: ignore\n                annotation_node.s,\n            ).body[0].value\n        except SyntaxError:\n            return 1\n\n    if isinstance(annotation_node, ast.Subscript):\n        return 1 + get_annotation_compexity(\n            annotation_node.slice.value,  # type: ignore\n        )\n    elif isinstance(annotation_node, (ast.Tuple, ast.List)):\n        return max(\n            (get_annotation_compexity(node) for node in annotation_node.elts),\n            default=1,\n        )\n    return 1\n", "path": "wemake_python_styleguide/logic/complexity/annotations.py"}]}