prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Refactor overloads away in 'random' stubs
  It seems that all the `@overload` decorators in `stubs/3.2/random.py` could be represented without overloading, such as by using union types.
  
  
  </issue>
  <code>
  [start of stubs/3.2/random.py]
  1 # Stubs for random
  2 # Ron Murawski <ron@horizonchess.com>
  3 # Updated by Jukka Lehtosalo
  4 
  5 # based on http://docs.python.org/3.2/library/random.html
  6 
  7 # ----- random classes -----
  8 
  9 import _random
  10 from typing import (
  11     Any, overload, typevar, Sequence, List, Function, AbstractSet
  12 )
  13 
  14 t = typevar('t')
  15 
  16 class Random(_random.Random):
  17     def __init__(self, x: Any = None) -> None: pass
  18     def seed(self, a: Any = None, version: int = 2) -> None: pass
  19     def getstate(self) -> tuple: pass
  20     def setstate(self, state: tuple) -> None: pass
  21     def getrandbits(self, k: int) -> int: pass
  22 
  23     @overload
  24     def randrange(self, stop: int) -> int: pass
  25     @overload
  26     def randrange(self, start: int, stop: int, step: int = 1) -> int: pass
  27 
  28     def randint(self, a: int, b: int) -> int: pass
  29     def choice(self, seq: Sequence[t]) -> t: pass
  30 
  31     @overload
  32     def shuffle(self, x: List[Any]) -> None: pass
  33     @overload
  34     def shuffle(self, x: List[Any], random: Function[[], float]) -> None: pass
  35 
  36     @overload
  37     def sample(self, population: Sequence[t], k: int) -> List[t]: pass
  38     @overload
  39     def sample(self, population: AbstractSet[t], k: int) -> List[t]: pass
  40 
  41     def random(self) -> float: pass
  42     def uniform(self, a: float, b: float) -> float: pass
  43     def triangular(self, low: float = 0.0, high: float = 1.0,
  44                      mode: float = None) -> float: pass
  45     def betavariate(self, alpha: float, beta: float) -> float: pass
  46     def expovariate(self, lambd: float) -> float: pass
  47     def gammavariate(self, alpha: float, beta: float) -> float: pass
  48     def gauss(self, mu: float, sigma: float) -> float: pass
  49     def lognormvariate(self, mu: float, sigma: float) -> float: pass
  50     def normalvariate(self, mu: float, sigma: float) -> float: pass
  51     def vonmisesvariate(self, mu: float, kappa: float) -> float: pass
  52     def paretovariate(self, alpha: float) -> float: pass
  53     def weibullvariate(self, alpha: float, beta: float) -> float: pass
  54 
  55 # SystemRandom is not implemented for all OS's; good on Windows & Linux
  56 class SystemRandom:
  57     def __init__(self, randseed: object = None) -> None: pass
  58     def random(self) -> float: pass
  59     def getrandbits(self, k: int) -> int: pass
  60     def seed(self, arg: object) -> None: pass
  61 
  62 # ----- random function stubs -----
  63 def seed(a: Any = None, version: int = 2) -> None: pass
  64 def getstate() -> object: pass
  65 def setstate(state: object) -> None: pass
  66 def getrandbits(k: int) -> int: pass
  67 
  68 @overload
  69 def randrange(stop: int) -> int: pass
  70 @overload
  71 def randrange(start: int, stop: int, step: int = 1) -> int: pass
  72 
  73 def randint(a: int, b: int) -> int: pass
  74 def choice(seq: Sequence[t]) -> t: pass
  75 
  76 @overload
  77 def shuffle(x: List[Any]) -> None: pass
  78 @overload
  79 def shuffle(x: List[Any], random: Function[[], float]) -> None: pass
  80 
  81 @overload
  82 def sample(population: Sequence[t], k: int) -> List[t]: pass
  83 @overload
  84 def sample(population: AbstractSet[t], k: int) -> List[t]: pass
  85 
  86 def random() -> float: pass
  87 def uniform(a: float, b: float) -> float: pass
  88 def triangular(low: float = 0.0, high: float = 1.0,
  89                mode: float = None) -> float: pass
  90 def betavariate(alpha: float, beta: float) -> float: pass
  91 def expovariate(lambd: float) -> float: pass
  92 def gammavariate(alpha: float, beta: float) -> float: pass
  93 def gauss(mu: float, sigma: float) -> float: pass
  94 def lognormvariate(mu: float, sigma: float) -> float: pass
  95 def normalvariate(mu: float, sigma: float) -> float: pass
  96 def vonmisesvariate(mu: float, kappa: float) -> float: pass
  97 def paretovariate(alpha: float) -> float: pass
  98 def weibullvariate(alpha: float, beta: float) -> float: pass
  99
  [end of stubs/3.2/random.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/stubs/3.2/random.py b/stubs/3.2/random.py
  --- a/stubs/3.2/random.py
  +++ b/stubs/3.2/random.py
  @@ -8,7 +8,7 @@
   
   import _random
   from typing import (
  -    Any, overload, typevar, Sequence, List, Function, AbstractSet
  +    Any, typevar, Sequence, List, Function, AbstractSet, Union
   )
   
   t = typevar('t')
  @@ -19,25 +19,11 @@
       def getstate(self) -> tuple: pass
       def setstate(self, state: tuple) -> None: pass
       def getrandbits(self, k: int) -> int: pass
  -
  -    @overload
  -    def randrange(self, stop: int) -> int: pass
  -    @overload
  -    def randrange(self, start: int, stop: int, step: int = 1) -> int: pass
  -
  +    def randrange(self, start: int, stop: Union[int, None] = None, step: int = 1) -> int: pass
       def randint(self, a: int, b: int) -> int: pass
       def choice(self, seq: Sequence[t]) -> t: pass
  -
  -    @overload
  -    def shuffle(self, x: List[Any]) -> None: pass
  -    @overload
  -    def shuffle(self, x: List[Any], random: Function[[], float]) -> None: pass
  -
  -    @overload
  -    def sample(self, population: Sequence[t], k: int) -> List[t]: pass
  -    @overload
  -    def sample(self, population: AbstractSet[t], k: int) -> List[t]: pass
  -
  +    def shuffle(self, x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass
  +    def sample(self, population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass
       def random(self) -> float: pass
       def uniform(self, a: float, b: float) -> float: pass
       def triangular(self, low: float = 0.0, high: float = 1.0,
  @@ -64,25 +50,11 @@
   def getstate() -> object: pass
   def setstate(state: object) -> None: pass
   def getrandbits(k: int) -> int: pass
  -
  -@overload
  -def randrange(stop: int) -> int: pass
  -@overload
  -def randrange(start: int, stop: int, step: int = 1) -> int: pass
  -
  +def randrange(start: int, stop: Union[None, int] = None, step: int = 1) -> int: pass
   def randint(a: int, b: int) -> int: pass
   def choice(seq: Sequence[t]) -> t: pass
  -
  -@overload
  -def shuffle(x: List[Any]) -> None: pass
  -@overload
  -def shuffle(x: List[Any], random: Function[[], float]) -> None: pass
  -
  -@overload
  -def sample(population: Sequence[t], k: int) -> List[t]: pass
  -@overload
  -def sample(population: AbstractSet[t], k: int) -> List[t]: pass
  -
  +def shuffle(x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass
  +def sample(population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass
   def random() -> float: pass
   def uniform(a: float, b: float) -> float: pass
   def triangular(low: float = 0.0, high: float = 1.0,
  
verification_info: {"golden_diff": "diff --git a/stubs/3.2/random.py b/stubs/3.2/random.py\n--- a/stubs/3.2/random.py\n+++ b/stubs/3.2/random.py\n@@ -8,7 +8,7 @@\n \n import _random\n from typing import (\n-    Any, overload, typevar, Sequence, List, Function, AbstractSet\n+    Any, typevar, Sequence, List, Function, AbstractSet, Union\n )\n \n t = typevar('t')\n@@ -19,25 +19,11 @@\n     def getstate(self) -> tuple: pass\n     def setstate(self, state: tuple) -> None: pass\n     def getrandbits(self, k: int) -> int: pass\n-\n-    @overload\n-    def randrange(self, stop: int) -> int: pass\n-    @overload\n-    def randrange(self, start: int, stop: int, step: int = 1) -> int: pass\n-\n+    def randrange(self, start: int, stop: Union[int, None] = None, step: int = 1) -> int: pass\n     def randint(self, a: int, b: int) -> int: pass\n     def choice(self, seq: Sequence[t]) -> t: pass\n-\n-    @overload\n-    def shuffle(self, x: List[Any]) -> None: pass\n-    @overload\n-    def shuffle(self, x: List[Any], random: Function[[], float]) -> None: pass\n-\n-    @overload\n-    def sample(self, population: Sequence[t], k: int) -> List[t]: pass\n-    @overload\n-    def sample(self, population: AbstractSet[t], k: int) -> List[t]: pass\n-\n+    def shuffle(self, x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass\n+    def sample(self, population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass\n     def random(self) -> float: pass\n     def uniform(self, a: float, b: float) -> float: pass\n     def triangular(self, low: float = 0.0, high: float = 1.0,\n@@ -64,25 +50,11 @@\n def getstate() -> object: pass\n def setstate(state: object) -> None: pass\n def getrandbits(k: int) -> int: pass\n-\n-@overload\n-def randrange(stop: int) -> int: pass\n-@overload\n-def randrange(start: int, stop: int, step: int = 1) -> int: pass\n-\n+def randrange(start: int, stop: Union[None, int] = None, step: int = 1) -> int: pass\n def randint(a: int, b: int) -> int: pass\n def choice(seq: Sequence[t]) -> t: pass\n-\n-@overload\n-def shuffle(x: List[Any]) -> None: pass\n-@overload\n-def shuffle(x: List[Any], random: Function[[], float]) -> None: pass\n-\n-@overload\n-def sample(population: Sequence[t], k: int) -> List[t]: pass\n-@overload\n-def sample(population: AbstractSet[t], k: int) -> List[t]: pass\n-\n+def shuffle(x: List[Any], random: Union[Function[[], float], None] = None) -> None: pass\n+def sample(population: Union[Sequence[t], AbstractSet[t]], k: int) -> List[t]: pass\n def random() -> float: pass\n def uniform(a: float, b: float) -> float: pass\n def triangular(low: float = 0.0, high: float = 1.0,\n", "issue": "Refactor overloads away in 'random' stubs\nIt seems that all the `@overload` decorators in `stubs/3.2/random.py` could be represented without overloading, such as by using union types.\n\n", "before_files": [{"content": "# Stubs for random\n# Ron Murawski <ron@horizonchess.com>\n# Updated by Jukka Lehtosalo\n\n# based on http://docs.python.org/3.2/library/random.html\n\n# ----- random classes -----\n\nimport _random\nfrom typing import (\n    Any, overload, typevar, Sequence, List, Function, AbstractSet\n)\n\nt = typevar('t')\n\nclass Random(_random.Random):\n    def __init__(self, x: Any = None) -> None: pass\n    def seed(self, a: Any = None, version: int = 2) -> None: pass\n    def getstate(self) -> tuple: pass\n    def setstate(self, state: tuple) -> None: pass\n    def getrandbits(self, k: int) -> int: pass\n\n    @overload\n    def randrange(self, stop: int) -> int: pass\n    @overload\n    def randrange(self, start: int, stop: int, step: int = 1) -> int: pass\n\n    def randint(self, a: int, b: int) -> int: pass\n    def choice(self, seq: Sequence[t]) -> t: pass\n\n    @overload\n    def shuffle(self, x: List[Any]) -> None: pass\n    @overload\n    def shuffle(self, x: List[Any], random: Function[[], float]) -> None: pass\n\n    @overload\n    def sample(self, population: Sequence[t], k: int) -> List[t]: pass\n    @overload\n    def sample(self, population: AbstractSet[t], k: int) -> List[t]: pass\n\n    def random(self) -> float: pass\n    def uniform(self, a: float, b: float) -> float: pass\n    def triangular(self, low: float = 0.0, high: float = 1.0,\n                     mode: float = None) -> float: pass\n    def betavariate(self, alpha: float, beta: float) -> float: pass\n    def expovariate(self, lambd: float) -> float: pass\n    def gammavariate(self, alpha: float, beta: float) -> float: pass\n    def gauss(self, mu: float, sigma: float) -> float: pass\n    def lognormvariate(self, mu: float, sigma: float) -> float: pass\n    def normalvariate(self, mu: float, sigma: float) -> float: pass\n    def vonmisesvariate(self, mu: float, kappa: float) -> float: pass\n    def paretovariate(self, alpha: float) -> float: pass\n    def weibullvariate(self, alpha: float, beta: float) -> float: pass\n\n# SystemRandom is not implemented for all OS's; good on Windows & Linux\nclass SystemRandom:\n    def __init__(self, randseed: object = None) -> None: pass\n    def random(self) -> float: pass\n    def getrandbits(self, k: int) -> int: pass\n    def seed(self, arg: object) -> None: pass\n\n# ----- random function stubs -----\ndef seed(a: Any = None, version: int = 2) -> None: pass\ndef getstate() -> object: pass\ndef setstate(state: object) -> None: pass\ndef getrandbits(k: int) -> int: pass\n\n@overload\ndef randrange(stop: int) -> int: pass\n@overload\ndef randrange(start: int, stop: int, step: int = 1) -> int: pass\n\ndef randint(a: int, b: int) -> int: pass\ndef choice(seq: Sequence[t]) -> t: pass\n\n@overload\ndef shuffle(x: List[Any]) -> None: pass\n@overload\ndef shuffle(x: List[Any], random: Function[[], float]) -> None: pass\n\n@overload\ndef sample(population: Sequence[t], k: int) -> List[t]: pass\n@overload\ndef sample(population: AbstractSet[t], k: int) -> List[t]: pass\n\ndef random() -> float: pass\ndef uniform(a: float, b: float) -> float: pass\ndef triangular(low: float = 0.0, high: float = 1.0,\n               mode: float = None) -> float: pass\ndef betavariate(alpha: float, beta: float) -> float: pass\ndef expovariate(lambd: float) -> float: pass\ndef gammavariate(alpha: float, beta: float) -> float: pass\ndef gauss(mu: float, sigma: float) -> float: pass\ndef lognormvariate(mu: float, sigma: float) -> float: pass\ndef normalvariate(mu: float, sigma: float) -> float: pass\ndef vonmisesvariate(mu: float, kappa: float) -> float: pass\ndef paretovariate(alpha: float) -> float: pass\ndef weibullvariate(alpha: float, beta: float) -> float: pass\n", "path": "stubs/3.2/random.py"}]}