prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Feature: ignore async function definitions from jones complexity check
  Currently we only ignore `ClassDef` and `FunctionDef`: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/visitors/ast/complexity/jones.py#L38-L41
  
  What needs to be done:
  1. ignore `AsyncFunctionDef` from the check
  2. we do not have a special test case for ignoring nodes for now. It should be added. We can call it `test_that_some_nodes_are_ignored`. It should test all three ignored nodes: with the lowest complexity threshold there should be no errors: https://github.com/wemake-services/wemake-python-styleguide/blob/master/tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py
  
  --- 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/visitors/ast/complexity/jones.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 """
  4 Jones Complexity to count inline complexity.
  5 
  6 Based on the original `jones-complexity` project:
  7 https://github.com/Miserlou/JonesComplexity
  8 
  9 Original project is licensed under MIT.
  10 """
  11 
  12 import ast
  13 from collections import defaultdict
  14 from statistics import median
  15 from typing import DefaultDict, List
  16 
  17 from wemake_python_styleguide.logics.nodes import is_subtype_of_any
  18 from wemake_python_styleguide.violations.complexity import (
  19     JonesScoreViolation,
  20     LineComplexityViolation,
  21 )
  22 from wemake_python_styleguide.visitors.base import BaseNodeVisitor
  23 
  24 
  25 class JonesComplexityVisitor(BaseNodeVisitor):  # TODO: consider `logical_line`
  26     """
  27     This visitor is used to find complex lines in the code.
  28 
  29     Calculates the number of AST nodes per line of code.
  30     Also calculates the median nodes/line score.
  31     Then compares these numbers to the given tressholds.
  32 
  33     Some nodes are ignored because there's no sense in analyzing them.
  34     Some nodes like type annotations are not affecting line complexity,
  35     so we do not count them.
  36     """
  37 
  38     _ignored_nodes = (
  39         ast.FunctionDef,
  40         ast.ClassDef,
  41     )
  42 
  43     def __init__(self, *args, **kwargs) -> None:
  44         """Initializes line number counter."""
  45         super().__init__(*args, **kwargs)
  46         self._lines: DefaultDict[int, List[ast.AST]] = defaultdict(list)
  47         self._to_ignore: List[ast.AST] = []
  48 
  49     def _post_visit(self) -> None:
  50         """
  51         Triggers after the whole module was processed.
  52 
  53         Checks each line for its complexity, compares it to the tresshold.
  54         We also calculate the final Jones score for the whole module.
  55         """
  56         for line_nodes in self._lines.values():
  57             complexity = len(line_nodes)
  58             if complexity > self.options.max_line_complexity:
  59                 self.add_violation(LineComplexityViolation(
  60                     line_nodes[0], text=str(complexity),
  61                 ))
  62 
  63         node_counts = [len(nodes) for nodes in self._lines.values()]
  64         total_count = median(node_counts) if node_counts else 0
  65         if total_count > self.options.max_jones_score:
  66             self.add_violation(JonesScoreViolation())
  67 
  68     def _maybe_ignore_child(self, node: ast.AST) -> bool:
  69         if isinstance(node, ast.AnnAssign):
  70             self._to_ignore.append(node.annotation)
  71 
  72         return node in self._to_ignore
  73 
  74     def visit(self, node: ast.AST) -> None:
  75         """
  76         Visits all nodes, sums the number of nodes per line.
  77 
  78         Then calculates the median value of all line results.
  79 
  80         Raises:
  81             JonesScoreViolation
  82             LineComplexityViolation
  83 
  84         """
  85         line_number = getattr(node, 'lineno', None)
  86         is_ignored = is_subtype_of_any(node, self._ignored_nodes)
  87         if line_number is not None and not is_ignored:
  88             if not self._maybe_ignore_child(node):
  89                 self._lines[line_number].append(node)
  90 
  91         self.generic_visit(node)
  92
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/wemake_python_styleguide/visitors/ast/complexity/jones.py b/wemake_python_styleguide/visitors/ast/complexity/jones.py
  --- a/wemake_python_styleguide/visitors/ast/complexity/jones.py
  +++ b/wemake_python_styleguide/visitors/ast/complexity/jones.py
  @@ -38,6 +38,7 @@
       _ignored_nodes = (
           ast.FunctionDef,
           ast.ClassDef,
  +        ast.AsyncFunctionDef,
       )
   
       def __init__(self, *args, **kwargs) -> None:
  
verification_info: {"golden_diff": "diff --git a/wemake_python_styleguide/visitors/ast/complexity/jones.py b/wemake_python_styleguide/visitors/ast/complexity/jones.py\n--- a/wemake_python_styleguide/visitors/ast/complexity/jones.py\n+++ b/wemake_python_styleguide/visitors/ast/complexity/jones.py\n@@ -38,6 +38,7 @@\n     _ignored_nodes = (\n         ast.FunctionDef,\n         ast.ClassDef,\n+        ast.AsyncFunctionDef,\n     )\n \n     def __init__(self, *args, **kwargs) -> None:\n", "issue": "Feature: ignore async function definitions from jones complexity check\nCurrently we only ignore `ClassDef` and `FunctionDef`: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/visitors/ast/complexity/jones.py#L38-L41\r\n\r\nWhat needs to be done:\r\n1. ignore `AsyncFunctionDef` from the check\r\n2. we do not have a special test case for ignoring nodes for now. It should be added. We can call it `test_that_some_nodes_are_ignored`. It should test all three ignored nodes: with the lowest complexity threshold there should be no errors: https://github.com/wemake-services/wemake-python-styleguide/blob/master/tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"\nJones Complexity to count inline complexity.\n\nBased on the original `jones-complexity` project:\nhttps://github.com/Miserlou/JonesComplexity\n\nOriginal project is licensed under MIT.\n\"\"\"\n\nimport ast\nfrom collections import defaultdict\nfrom statistics import median\nfrom typing import DefaultDict, List\n\nfrom wemake_python_styleguide.logics.nodes import is_subtype_of_any\nfrom wemake_python_styleguide.violations.complexity import (\n    JonesScoreViolation,\n    LineComplexityViolation,\n)\nfrom wemake_python_styleguide.visitors.base import BaseNodeVisitor\n\n\nclass JonesComplexityVisitor(BaseNodeVisitor):  # TODO: consider `logical_line`\n    \"\"\"\n    This visitor is used to find complex lines in the code.\n\n    Calculates the number of AST nodes per line of code.\n    Also calculates the median nodes/line score.\n    Then compares these numbers to the given tressholds.\n\n    Some nodes are ignored because there's no sense in analyzing them.\n    Some nodes like type annotations are not affecting line complexity,\n    so we do not count them.\n    \"\"\"\n\n    _ignored_nodes = (\n        ast.FunctionDef,\n        ast.ClassDef,\n    )\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initializes line number counter.\"\"\"\n        super().__init__(*args, **kwargs)\n        self._lines: DefaultDict[int, List[ast.AST]] = defaultdict(list)\n        self._to_ignore: List[ast.AST] = []\n\n    def _post_visit(self) -> None:\n        \"\"\"\n        Triggers after the whole module was processed.\n\n        Checks each line for its complexity, compares it to the tresshold.\n        We also calculate the final Jones score for the whole module.\n        \"\"\"\n        for line_nodes in self._lines.values():\n            complexity = len(line_nodes)\n            if complexity > self.options.max_line_complexity:\n                self.add_violation(LineComplexityViolation(\n                    line_nodes[0], text=str(complexity),\n                ))\n\n        node_counts = [len(nodes) for nodes in self._lines.values()]\n        total_count = median(node_counts) if node_counts else 0\n        if total_count > self.options.max_jones_score:\n            self.add_violation(JonesScoreViolation())\n\n    def _maybe_ignore_child(self, node: ast.AST) -> bool:\n        if isinstance(node, ast.AnnAssign):\n            self._to_ignore.append(node.annotation)\n\n        return node in self._to_ignore\n\n    def visit(self, node: ast.AST) -> None:\n        \"\"\"\n        Visits all nodes, sums the number of nodes per line.\n\n        Then calculates the median value of all line results.\n\n        Raises:\n            JonesScoreViolation\n            LineComplexityViolation\n\n        \"\"\"\n        line_number = getattr(node, 'lineno', None)\n        is_ignored = is_subtype_of_any(node, self._ignored_nodes)\n        if line_number is not None and not is_ignored:\n            if not self._maybe_ignore_child(node):\n                self._lines[line_number].append(node)\n\n        self.generic_visit(node)\n", "path": "wemake_python_styleguide/visitors/ast/complexity/jones.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"\nJones Complexity to count inline complexity.\n\nBased on the original `jones-complexity` project:\nhttps://github.com/Miserlou/JonesComplexity\n\nOriginal project is licensed under MIT.\n\"\"\"\n\nimport ast\nfrom collections import defaultdict\nfrom statistics import median\nfrom typing import DefaultDict, List\n\nfrom wemake_python_styleguide.logics.nodes import is_subtype_of_any\nfrom wemake_python_styleguide.violations.complexity import (\n    JonesScoreViolation,\n    LineComplexityViolation,\n)\nfrom wemake_python_styleguide.visitors.base import BaseNodeVisitor\n\n\nclass JonesComplexityVisitor(BaseNodeVisitor):  # TODO: consider `logical_line`\n    \"\"\"\n    This visitor is used to find complex lines in the code.\n\n    Calculates the number of AST nodes per line of code.\n    Also calculates the median nodes/line score.\n    Then compares these numbers to the given tressholds.\n\n    Some nodes are ignored because there's no sense in analyzing them.\n    Some nodes like type annotations are not affecting line complexity,\n    so we do not count them.\n    \"\"\"\n\n    _ignored_nodes = (\n        ast.FunctionDef,\n        ast.ClassDef,\n        ast.AsyncFunctionDef,\n    )\n\n    def __init__(self, *args, **kwargs) -> None:\n        \"\"\"Initializes line number counter.\"\"\"\n        super().__init__(*args, **kwargs)\n        self._lines: DefaultDict[int, List[ast.AST]] = defaultdict(list)\n        self._to_ignore: List[ast.AST] = []\n\n    def _post_visit(self) -> None:\n        \"\"\"\n        Triggers after the whole module was processed.\n\n        Checks each line for its complexity, compares it to the tresshold.\n        We also calculate the final Jones score for the whole module.\n        \"\"\"\n        for line_nodes in self._lines.values():\n            complexity = len(line_nodes)\n            if complexity > self.options.max_line_complexity:\n                self.add_violation(LineComplexityViolation(\n                    line_nodes[0], text=str(complexity),\n                ))\n\n        node_counts = [len(nodes) for nodes in self._lines.values()]\n        total_count = median(node_counts) if node_counts else 0\n        if total_count > self.options.max_jones_score:\n            self.add_violation(JonesScoreViolation())\n\n    def _maybe_ignore_child(self, node: ast.AST) -> bool:\n        if isinstance(node, ast.AnnAssign):\n            self._to_ignore.append(node.annotation)\n\n        return node in self._to_ignore\n\n    def visit(self, node: ast.AST) -> None:\n        \"\"\"\n        Visits all nodes, sums the number of nodes per line.\n\n        Then calculates the median value of all line results.\n\n        Raises:\n            JonesScoreViolation\n            LineComplexityViolation\n\n        \"\"\"\n        line_number = getattr(node, 'lineno', None)\n        is_ignored = is_subtype_of_any(node, self._ignored_nodes)\n        if line_number is not None and not is_ignored:\n            if not self._maybe_ignore_child(node):\n                self._lines[line_number].append(node)\n\n        self.generic_visit(node)\n", "path": "wemake_python_styleguide/visitors/ast/complexity/jones.py"}]}