We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Refactor how version is defined
Currently we just have a legacy `version.py` file with version inside it.
It duplicates the version information from `pyproject.toml`.

That's how it should be: https://github.com/sdispater/poetry/issues/273#issuecomment-401983643

--- 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/version.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 __version__ = '0.0.2'  # noqa
4 # TODO: resolve after https://github.com/sdispater/poetry/issues/273
5
```

Path: `wemake_python_styleguide/checker.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 from ast import Module
4 from typing import Generator, Tuple
5 
6 from wemake_python_styleguide.version import __version__
7 from wemake_python_styleguide.visitors.high_complexity import ComplexityVisitor
8 from wemake_python_styleguide.visitors.wrong_function_call import (
9     WrongFunctionCallVisitor,
10 )
11 from wemake_python_styleguide.visitors.wrong_import import WrongImportVisitor
12 from wemake_python_styleguide.visitors.wrong_keyword import (
13     WrongKeywordVisitor,
14     WrongRaiseVisitor,
15 )
16 from wemake_python_styleguide.visitors.wrong_name import (
17     WrongModuleMetadataVisitor,
18     WrongNameVisitor,
19 )
20 from wemake_python_styleguide.visitors.wrong_nested import WrongNestedVisitor
21 
22 CheckResult = Tuple[int, int, str, type]
23 
24 
25 class Checker(object):
26     """
27     Main checker class.
28 
29     Runs all possible checks.
30     """
31 
32     name = 'wemake-python-styleguide'
33     version = __version__
34 
35     def __init__(self, tree: Module, filename: str = '-') -> None:
36         """Creates new checker instance."""
37         self.tree = tree
38         self.filename = filename
39 
40         self._visitors = (
41             WrongRaiseVisitor,
42             WrongFunctionCallVisitor,
43             WrongImportVisitor,
44             WrongKeywordVisitor,
45             WrongNestedVisitor,
46             ComplexityVisitor,
47             WrongNameVisitor,
48             WrongModuleMetadataVisitor,
49         )
50 
51     def run(self) -> Generator[CheckResult, None, None]:
52         """
53         Runs the checker.
54 
55         This method is used by `flake8` API.
56         """
57         for visitor_class in self._visitors:
58             visiter = visitor_class()
59             visiter.visit(self.tree)
60 
61             for error in visiter.errors:
62                 lineno, col_offset, message = error.node_items()
63                 yield lineno, col_offset, message, type(self)
64
```
--- 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/checker.py b/wemake_python_styleguide/checker.py
--- a/wemake_python_styleguide/checker.py
+++ b/wemake_python_styleguide/checker.py
@@ -3,7 +3,7 @@
 from ast import Module
 from typing import Generator, Tuple
 
-from wemake_python_styleguide.version import __version__
+from wemake_python_styleguide.version import version
 from wemake_python_styleguide.visitors.high_complexity import ComplexityVisitor
 from wemake_python_styleguide.visitors.wrong_function_call import (
     WrongFunctionCallVisitor,
@@ -30,7 +30,7 @@
     """
 
     name = 'wemake-python-styleguide'
-    version = __version__
+    version = version
 
     def __init__(self, tree: Module, filename: str = '-') -> None:
         """Creates new checker instance."""
diff --git a/wemake_python_styleguide/version.py b/wemake_python_styleguide/version.py
--- a/wemake_python_styleguide/version.py
+++ b/wemake_python_styleguide/version.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
 
-__version__ = '0.0.2'  # noqa
-# TODO: resolve after https://github.com/sdispater/poetry/issues/273
+import pkg_resources
+
+version = pkg_resources.get_distribution('wemake-python-styleguide').version

{"golden_diff": "diff --git a/wemake_python_styleguide/checker.py b/wemake_python_styleguide/checker.py\n--- a/wemake_python_styleguide/checker.py\n+++ b/wemake_python_styleguide/checker.py\n@@ -3,7 +3,7 @@\n from ast import Module\n from typing import Generator, Tuple\n \n-from wemake_python_styleguide.version import __version__\n+from wemake_python_styleguide.version import version\n from wemake_python_styleguide.visitors.high_complexity import ComplexityVisitor\n from wemake_python_styleguide.visitors.wrong_function_call import (\n     WrongFunctionCallVisitor,\n@@ -30,7 +30,7 @@\n     \"\"\"\n \n     name = 'wemake-python-styleguide'\n-    version = __version__\n+    version = version\n \n     def __init__(self, tree: Module, filename: str = '-') -> None:\n         \"\"\"Creates new checker instance.\"\"\"\ndiff --git a/wemake_python_styleguide/version.py b/wemake_python_styleguide/version.py\n--- a/wemake_python_styleguide/version.py\n+++ b/wemake_python_styleguide/version.py\n@@ -1,4 +1,5 @@\n # -*- coding: utf-8 -*-\n \n-__version__ = '0.0.2'  # noqa\n-# TODO: resolve after https://github.com/sdispater/poetry/issues/273\n+import pkg_resources\n+\n+version = pkg_resources.get_distribution('wemake-python-styleguide').version\n", "issue": "Refactor how version is defined\nCurrently we just have a legacy `version.py` file with version inside it.\r\nIt duplicates the version information from `pyproject.toml`.\r\n\r\nThat's how it should be: https://github.com/sdispater/poetry/issues/273#issuecomment-401983643\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n__version__ = '0.0.2'  # noqa\n# TODO: resolve after https://github.com/sdispater/poetry/issues/273\n", "path": "wemake_python_styleguide/version.py"}, {"content": "# -*- coding: utf-8 -*-\n\nfrom ast import Module\nfrom typing import Generator, Tuple\n\nfrom wemake_python_styleguide.version import __version__\nfrom wemake_python_styleguide.visitors.high_complexity import ComplexityVisitor\nfrom wemake_python_styleguide.visitors.wrong_function_call import (\n    WrongFunctionCallVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_import import WrongImportVisitor\nfrom wemake_python_styleguide.visitors.wrong_keyword import (\n    WrongKeywordVisitor,\n    WrongRaiseVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_name import (\n    WrongModuleMetadataVisitor,\n    WrongNameVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_nested import WrongNestedVisitor\n\nCheckResult = Tuple[int, int, str, type]\n\n\nclass Checker(object):\n    \"\"\"\n    Main checker class.\n\n    Runs all possible checks.\n    \"\"\"\n\n    name = 'wemake-python-styleguide'\n    version = __version__\n\n    def __init__(self, tree: Module, filename: str = '-') -> None:\n        \"\"\"Creates new checker instance.\"\"\"\n        self.tree = tree\n        self.filename = filename\n\n        self._visitors = (\n            WrongRaiseVisitor,\n            WrongFunctionCallVisitor,\n            WrongImportVisitor,\n            WrongKeywordVisitor,\n            WrongNestedVisitor,\n            ComplexityVisitor,\n            WrongNameVisitor,\n            WrongModuleMetadataVisitor,\n        )\n\n    def run(self) -> Generator[CheckResult, None, None]:\n        \"\"\"\n        Runs the checker.\n\n        This method is used by `flake8` API.\n        \"\"\"\n        for visitor_class in self._visitors:\n            visiter = visitor_class()\n            visiter.visit(self.tree)\n\n            for error in visiter.errors:\n                lineno, col_offset, message = error.node_items()\n                yield lineno, col_offset, message, type(self)\n", "path": "wemake_python_styleguide/checker.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport pkg_resources\n\nversion = pkg_resources.get_distribution('wemake-python-styleguide').version\n", "path": "wemake_python_styleguide/version.py"}, {"content": "# -*- coding: utf-8 -*-\n\nfrom ast import Module\nfrom typing import Generator, Tuple\n\nfrom wemake_python_styleguide.version import version\nfrom wemake_python_styleguide.visitors.high_complexity import ComplexityVisitor\nfrom wemake_python_styleguide.visitors.wrong_function_call import (\n    WrongFunctionCallVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_import import WrongImportVisitor\nfrom wemake_python_styleguide.visitors.wrong_keyword import (\n    WrongKeywordVisitor,\n    WrongRaiseVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_name import (\n    WrongModuleMetadataVisitor,\n    WrongNameVisitor,\n)\nfrom wemake_python_styleguide.visitors.wrong_nested import WrongNestedVisitor\n\nCheckResult = Tuple[int, int, str, type]\n\n\nclass Checker(object):\n    \"\"\"\n    Main checker class.\n\n    Runs all possible checks.\n    \"\"\"\n\n    name = 'wemake-python-styleguide'\n    version = version\n\n    def __init__(self, tree: Module, filename: str = '-') -> None:\n        \"\"\"Creates new checker instance.\"\"\"\n        self.tree = tree\n        self.filename = filename\n\n        self._visitors = (\n            WrongRaiseVisitor,\n            WrongFunctionCallVisitor,\n            WrongImportVisitor,\n            WrongKeywordVisitor,\n            WrongNestedVisitor,\n            ComplexityVisitor,\n            WrongNameVisitor,\n            WrongModuleMetadataVisitor,\n        )\n\n    def run(self) -> Generator[CheckResult, None, None]:\n        \"\"\"\n        Runs the checker.\n\n        This method is used by `flake8` API.\n        \"\"\"\n        for visitor_class in self._visitors:\n            visiter = visitor_class()\n            visiter.visit(self.tree)\n\n            for error in visiter.errors:\n                lineno, col_offset, message = error.node_items()\n                yield lineno, col_offset, message, type(self)\n", "path": "wemake_python_styleguide/checker.py"}]}