prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  extract
  
  
  </issue>
  <code>
  [start of ivy/functional/frontends/numpy/sorting_searching_counting/searching.py]
  1 # local
  2 
  3 import ivy
  4 
  5 from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
  6 
  7 from ivy.functional.frontends.numpy.func_wrapper import (
  8     to_ivy_arrays_and_back,
  9     from_zero_dim_arrays_to_scalar,
  10     handle_numpy_out,
  11 )
  12 
  13 
  14 @to_ivy_arrays_and_back
  15 def where(cond, x1=None, x2=None, /):
  16     if x1 is None and x2 is None:
  17         # numpy where behaves as np.asarray(condition).nonzero() when x and y
  18         # not included
  19         return ivy.asarray(cond).nonzero()
  20     elif x1 is not None and x2 is not None:
  21         x1, x2 = promote_types_of_numpy_inputs(x1, x2)
  22         return ivy.where(cond, x1, x2)
  23     else:
  24         raise ivy.utils.exceptions.IvyException("where takes either 1 or 3 arguments")
  25 
  26 
  27 @to_ivy_arrays_and_back
  28 def nonzero(a):
  29     return ivy.nonzero(a)
  30 
  31 
  32 @handle_numpy_out
  33 @to_ivy_arrays_and_back
  34 @from_zero_dim_arrays_to_scalar
  35 def argmin(a, /, *, axis=None, keepdims=False, out=None):
  36     return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)
  37 
  38 
  39 @handle_numpy_out
  40 @to_ivy_arrays_and_back
  41 @from_zero_dim_arrays_to_scalar
  42 def argmax(
  43     a,
  44     /,
  45     *,
  46     axis=None,
  47     out=None,
  48     keepdims=False,
  49 ):
  50     return ivy.argmax(a, axis=axis, out=out, keepdims=keepdims)
  51 
  52 
  53 @to_ivy_arrays_and_back
  54 def flatnonzero(a):
  55     return ivy.nonzero(ivy.reshape(a, (-1,)))
  56 
  57 
  58 @to_ivy_arrays_and_back
  59 def searchsorted(a, v, side="left", sorter=None):
  60     return ivy.searchsorted(a, v, side=side, sorter=sorter)
  61 
  62 
  63 @to_ivy_arrays_and_back
  64 def argwhere(a):
  65     return ivy.argwhere(a)
  66 
  67 
  68 # nanargmin and nanargmax composition helper
  69 def _nanargminmax(a, axis=None):
  70     # check nans
  71     nans = ivy.isnan(a).astype(ivy.bool)
  72     # replace nans with inf
  73     a = ivy.where(nans, ivy.inf, a)
  74     if nans is not None:
  75         nans = ivy.all(nans, axis=axis)
  76         if ivy.any(nans):
  77             raise ivy.utils.exceptions.IvyError("All-NaN slice encountered")
  78     return a
  79 
  80 
  81 @handle_numpy_out
  82 @to_ivy_arrays_and_back
  83 @from_zero_dim_arrays_to_scalar
  84 def nanargmax(a, /, *, axis=None, out=None, keepdims=False):
  85     a = _nanargminmax(a, axis=axis)
  86     return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)
  87 
  88 
  89 @handle_numpy_out
  90 @to_ivy_arrays_and_back
  91 @from_zero_dim_arrays_to_scalar
  92 def nanargmin(a, /, *, axis=None, out=None, keepdims=False):
  93     a = _nanargminmax(a, axis=axis)
  94     return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)
  95
  [end of ivy/functional/frontends/numpy/sorting_searching_counting/searching.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/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
  --- a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
  +++ b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py
  @@ -92,3 +92,11 @@
   def nanargmin(a, /, *, axis=None, out=None, keepdims=False):
       a = _nanargminmax(a, axis=axis)
       return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)
  +
  +
  +@to_ivy_arrays_and_back
  +def extract(cond, arr, /):
  +    if cond.dtype == 'bool':
  +        return arr[cond]
  +    else:
  +        return arr[cond !=0]
  \ No newline at end of file
  
verification_info: {"golden_diff": "diff --git a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n--- a/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n+++ b/ivy/functional/frontends/numpy/sorting_searching_counting/searching.py\n@@ -92,3 +92,11 @@\n def nanargmin(a, /, *, axis=None, out=None, keepdims=False):\n     a = _nanargminmax(a, axis=axis)\n     return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)\n+\n+\n+@to_ivy_arrays_and_back\n+def extract(cond, arr, /):\n+    if cond.dtype == 'bool':\n+        return arr[cond]\n+    else:\n+        return arr[cond !=0]\n\\ No newline at end of file\n", "issue": "extract\n\n", "before_files": [{"content": "# local\n\nimport ivy\n\nfrom ivy.functional.frontends.numpy import promote_types_of_numpy_inputs\n\nfrom ivy.functional.frontends.numpy.func_wrapper import (\n    to_ivy_arrays_and_back,\n    from_zero_dim_arrays_to_scalar,\n    handle_numpy_out,\n)\n\n\n@to_ivy_arrays_and_back\ndef where(cond, x1=None, x2=None, /):\n    if x1 is None and x2 is None:\n        # numpy where behaves as np.asarray(condition).nonzero() when x and y\n        # not included\n        return ivy.asarray(cond).nonzero()\n    elif x1 is not None and x2 is not None:\n        x1, x2 = promote_types_of_numpy_inputs(x1, x2)\n        return ivy.where(cond, x1, x2)\n    else:\n        raise ivy.utils.exceptions.IvyException(\"where takes either 1 or 3 arguments\")\n\n\n@to_ivy_arrays_and_back\ndef nonzero(a):\n    return ivy.nonzero(a)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmin(a, /, *, axis=None, keepdims=False, out=None):\n    return ivy.argmin(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef argmax(\n    a,\n    /,\n    *,\n    axis=None,\n    out=None,\n    keepdims=False,\n):\n    return ivy.argmax(a, axis=axis, out=out, keepdims=keepdims)\n\n\n@to_ivy_arrays_and_back\ndef flatnonzero(a):\n    return ivy.nonzero(ivy.reshape(a, (-1,)))\n\n\n@to_ivy_arrays_and_back\ndef searchsorted(a, v, side=\"left\", sorter=None):\n    return ivy.searchsorted(a, v, side=side, sorter=sorter)\n\n\n@to_ivy_arrays_and_back\ndef argwhere(a):\n    return ivy.argwhere(a)\n\n\n# nanargmin and nanargmax composition helper\ndef _nanargminmax(a, axis=None):\n    # check nans\n    nans = ivy.isnan(a).astype(ivy.bool)\n    # replace nans with inf\n    a = ivy.where(nans, ivy.inf, a)\n    if nans is not None:\n        nans = ivy.all(nans, axis=axis)\n        if ivy.any(nans):\n            raise ivy.utils.exceptions.IvyError(\"All-NaN slice encountered\")\n    return a\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmax(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmax(a, axis=axis, keepdims=keepdims, out=out)\n\n\n@handle_numpy_out\n@to_ivy_arrays_and_back\n@from_zero_dim_arrays_to_scalar\ndef nanargmin(a, /, *, axis=None, out=None, keepdims=False):\n    a = _nanargminmax(a, axis=axis)\n    return ivy.argmin(a, axis=axis, keepdims=keepdims, out=out)\n", "path": "ivy/functional/frontends/numpy/sorting_searching_counting/searching.py"}]}