prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Wrong and correct examples of nested annotations mixed up in docs for Union type
  # Bug report
  
  <!--
  Hi, thanks for submitting a bug. We appreciate that.
  
  But, we will need some information about what's wrong to help you.
  -->
  
  ## What's wrong
  
  From ``NestedAnnotationsViolation`` class docstring:
  ```
  Example::
          # Correct:
          Literal[1, 2, 3, "foo", 5, None]
          Union[Union[int, str], float]
  
          # Wrong:
          Literal[Literal[Literal[1, 2, 3], "foo"], 5, None]
          Union[int, str, float]
  ```
  There is a mistake: correct and wrong examples for ``Union`` type are mixed up. If I run flake8 passing it a file which contains ``Union[int, str, float]`` annotation, no error will be raised. And for ``Union[Union[int, str], float]`` WPS702 is raised. Both are expected behaviour I guess, just a mismatch in documentation.
  ## How is that should be
  
  ```
  Example::
          # Correct:
          Literal[1, 2, 3, "foo", 5, None]
          Union[int, str, float]
  
          # Wrong:
          Literal[Literal[Literal[1, 2, 3], "foo"], 5, None]
          Union[Union[int, str], float]
  ```
  <!--
  
    Love wemake-python-styleguide? ❤️
    Do you want your bugs to be solved faster?
  
    Please consider supporting our collective:
  👉  https://opencollective.com/wemake-python-styleguide/donate
  
  -->
  
  
  </issue>
  <code>
  [start of wemake_python_styleguide/violations/annotations.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 """
  4 These checks help to prevent incorrect usage of Python 3 typing annotations.
  5 
  6 While they maybe of a great help in writing clear
  7 and concise code, they still can be abused.
  8 
  9 Once again, these rules are highly subjective. But, we love them.
  10 
  11 .. currentmodule:: wemake_python_styleguide.violations.annotations
  12 
  13 Summary
  14 -------
  15 
  16 .. autosummary::
  17    :nosignatures:
  18 
  19    LiteralNoneViolation
  20    NestedAnnotationsViolation
  21 
  22 Annotation checks
  23 ------------------
  24 
  25 .. autoclass:: LiteralNoneViolation
  26 .. autoclass:: NestedAnnotationsViolation
  27 
  28 """
  29 
  30 from typing_extensions import final
  31 
  32 from wemake_python_styleguide.violations.base import ASTViolation
  33 
  34 
  35 @final
  36 class LiteralNoneViolation(ASTViolation):
  37     """
  38     Forbids to use ``Literal[None]`` typing annotation.
  39 
  40     Reasoning:
  41         Literal[None] is just the same as None.
  42         There's no need to use the first version.
  43         It is not type related, it is a consistency rule.
  44 
  45     Solution:
  46         Replace ``Literal[None]`` with ``None``.
  47 
  48     Example::
  49 
  50         # Correct:
  51         def func(empty: None):
  52             '''Empty function.'''
  53 
  54         # Wrong:
  55         def func(empty: Literal[None]):
  56             '''Empty function.'''
  57 
  58     .. versionadded:: 0.13.0
  59 
  60     """
  61 
  62     code = 701
  63     error_template = 'Found useless `Literal[None]` typing annotation'
  64 
  65 
  66 @final
  67 class NestedAnnotationsViolation(ASTViolation):
  68     """
  69     Forbids use of nested Literal and Union Annotation.
  70 
  71     Reasoning:
  72         There is no need to nest certain annotations of the same type.
  73         They are exactly equivalent to the flattened version.
  74         Use the flattened version for consistency.
  75 
  76     Solution:
  77         Flatten consecutively nested ``typing.Literal`` and ``typing.Union``.
  78 
  79     Example::
  80         # Correct:
  81         Literal[1, 2, 3, "foo", 5, None]
  82         Union[Union[int, str], float]
  83 
  84         # Wrong:
  85         Literal[Literal[Literal[1, 2, 3], "foo"], 5, None]
  86         Union[int, str, float]
  87 
  88     .. versionadded:: 0.13.0
  89 
  90     """
  91 
  92     error_template = 'Found redundant nested typing annotation'
  93     code = 702
  94
  [end of wemake_python_styleguide/violations/annotations.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/wemake_python_styleguide/violations/annotations.py b/wemake_python_styleguide/violations/annotations.py
  --- a/wemake_python_styleguide/violations/annotations.py
  +++ b/wemake_python_styleguide/violations/annotations.py
  @@ -79,11 +79,11 @@
       Example::
           # Correct:
           Literal[1, 2, 3, "foo", 5, None]
  -        Union[Union[int, str], float]
  +        Union[int, str, float]
   
           # Wrong:
           Literal[Literal[Literal[1, 2, 3], "foo"], 5, None]
  -        Union[int, str, float]
  +        Union[Union[int, str], float]
   
       .. versionadded:: 0.13.0
  
verification_info: {"golden_diff": "diff --git a/wemake_python_styleguide/violations/annotations.py b/wemake_python_styleguide/violations/annotations.py\n--- a/wemake_python_styleguide/violations/annotations.py\n+++ b/wemake_python_styleguide/violations/annotations.py\n@@ -79,11 +79,11 @@\n     Example::\n         # Correct:\n         Literal[1, 2, 3, \"foo\", 5, None]\n-        Union[Union[int, str], float]\n+        Union[int, str, float]\n \n         # Wrong:\n         Literal[Literal[Literal[1, 2, 3], \"foo\"], 5, None]\n-        Union[int, str, float]\n+        Union[Union[int, str], float]\n \n     .. versionadded:: 0.13.0\n", "issue": "Wrong and correct examples of nested annotations mixed up in docs for Union type\n# Bug report\r\n\r\n<!--\r\nHi, thanks for submitting a bug. We appreciate that.\r\n\r\nBut, we will need some information about what's wrong to help you.\r\n-->\r\n\r\n## What's wrong\r\n\r\nFrom ``NestedAnnotationsViolation`` class docstring:\r\n```\r\nExample::\r\n        # Correct:\r\n        Literal[1, 2, 3, \"foo\", 5, None]\r\n        Union[Union[int, str], float]\r\n\r\n        # Wrong:\r\n        Literal[Literal[Literal[1, 2, 3], \"foo\"], 5, None]\r\n        Union[int, str, float]\r\n```\r\nThere is a mistake: correct and wrong examples for ``Union`` type are mixed up. If I run flake8 passing it a file which contains ``Union[int, str, float]`` annotation, no error will be raised. And for ``Union[Union[int, str], float]`` WPS702 is raised. Both are expected behaviour I guess, just a mismatch in documentation.\r\n## How is that should be\r\n\r\n```\r\nExample::\r\n        # Correct:\r\n        Literal[1, 2, 3, \"foo\", 5, None]\r\n        Union[int, str, float]\r\n\r\n        # Wrong:\r\n        Literal[Literal[Literal[1, 2, 3], \"foo\"], 5, None]\r\n        Union[Union[int, str], float]\r\n```\r\n<!--\r\n\r\n  Love wemake-python-styleguide? \u2764\ufe0f\r\n  Do you want your bugs to be solved faster?\r\n\r\n  Please consider supporting our collective:\r\n\ud83d\udc49  https://opencollective.com/wemake-python-styleguide/donate\r\n\r\n-->\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"\nThese checks help to prevent incorrect usage of Python 3 typing annotations.\n\nWhile they maybe of a great help in writing clear\nand concise code, they still can be abused.\n\nOnce again, these rules are highly subjective. But, we love them.\n\n.. currentmodule:: wemake_python_styleguide.violations.annotations\n\nSummary\n-------\n\n.. autosummary::\n   :nosignatures:\n\n   LiteralNoneViolation\n   NestedAnnotationsViolation\n\nAnnotation checks\n------------------\n\n.. autoclass:: LiteralNoneViolation\n.. autoclass:: NestedAnnotationsViolation\n\n\"\"\"\n\nfrom typing_extensions import final\n\nfrom wemake_python_styleguide.violations.base import ASTViolation\n\n\n@final\nclass LiteralNoneViolation(ASTViolation):\n    \"\"\"\n    Forbids to use ``Literal[None]`` typing annotation.\n\n    Reasoning:\n        Literal[None] is just the same as None.\n        There's no need to use the first version.\n        It is not type related, it is a consistency rule.\n\n    Solution:\n        Replace ``Literal[None]`` with ``None``.\n\n    Example::\n\n        # Correct:\n        def func(empty: None):\n            '''Empty function.'''\n\n        # Wrong:\n        def func(empty: Literal[None]):\n            '''Empty function.'''\n\n    .. versionadded:: 0.13.0\n\n    \"\"\"\n\n    code = 701\n    error_template = 'Found useless `Literal[None]` typing annotation'\n\n\n@final\nclass NestedAnnotationsViolation(ASTViolation):\n    \"\"\"\n    Forbids use of nested Literal and Union Annotation.\n\n    Reasoning:\n        There is no need to nest certain annotations of the same type.\n        They are exactly equivalent to the flattened version.\n        Use the flattened version for consistency.\n\n    Solution:\n        Flatten consecutively nested ``typing.Literal`` and ``typing.Union``.\n\n    Example::\n        # Correct:\n        Literal[1, 2, 3, \"foo\", 5, None]\n        Union[Union[int, str], float]\n\n        # Wrong:\n        Literal[Literal[Literal[1, 2, 3], \"foo\"], 5, None]\n        Union[int, str, float]\n\n    .. versionadded:: 0.13.0\n\n    \"\"\"\n\n    error_template = 'Found redundant nested typing annotation'\n    code = 702\n", "path": "wemake_python_styleguide/violations/annotations.py"}]}