code: import colorsys
  import io
  
  import cva
  import matplotlib as mpl
  import matplotlib.colors as mplc
  import matplotlib.figure as mplfigure
  import numpy as np
  import torch
  from matplotlib.backends.backend_agg import FigureCanvasAgg
  
  from utils import img_tensorize
  
  
  _SCREAMING_SNAKE_CASE   						=    1000
  
  
  
  
  
  
  
  class 					UpperCAmelCase_				:
  
  
  
  
      def __init__(					self  :   List[str]      ,      lowerCAmelCase  :   Any      ,      lowerCAmelCase  :   int=1.2      ,      lowerCAmelCase  :   List[str]="g"      ,      lowerCAmelCase  :   Dict=0.5      ,      lowerCAmelCase  :   Dict="-"      ,      lowerCAmelCase  :   Optional[int]="test_out.jpg"      ,      lowerCAmelCase  :   int=True      ,      lowerCAmelCase  :   Optional[int]=False      ,      lowerCAmelCase  :   Optional[int]=None      ,      lowerCAmelCase  :   List[str]=None      ,      lowerCAmelCase  :   Any=0.7      ,      )	-> Tuple:
        if isinstance(lowerCAmelCase      ,      torch.Tensor   ):
          a__     		=     img.numpy().astype("np.uint8"   )
        if isinstance(lowerCAmelCase      ,      lowerCAmelCase   ):
          a__     		=     img_tensorize(lowerCAmelCase   )
        assert isinstance(lowerCAmelCase      ,      np.ndarray   )
  
        a__		,a__     		=     img.shape[1], img.shape[0]
        a__     		=     mplfigure.Figure(frameon=lowerCAmelCase   )
        a__     		=     fig.get_dpi()
        a__     		=     (width * scale + 1e-2) / dpi
        a__     		=     (height * scale + 1e-2) / dpi
        fig.set_size_inches(lowerCAmelCase      ,      lowerCAmelCase   )
        a__     		=     fig.add_axes([0.0, 0.0, 1.0, 1.0]   )
        ax.axis("off"   )
        ax.set_xlim(0.0      ,      lowerCAmelCase   )
        ax.set_ylim(lowerCAmelCase   )
  
        a__     		=     saveas
        a__     		=     rgb
        a__     		=     pynb
        a__     		=     img
        a__     		=     edgecolor
        a__     		=     0.5
        a__     		=     linestyle
        a__     		=     int(np.sqrt(min(lowerCAmelCase      ,      lowerCAmelCase   )   ) * scale // 3   )
        a__     		=     width
        a__     		=     height
        a__     		=     scale
        a__     		=     fig
        a__     		=     ax
        a__     		=     pad
        a__     		=     idaobj
        a__     		=     idaattr
        a__     		=     FigureCanvasAgg(lowerCAmelCase   )
  
  
  
  
      def 						__lowerCamelCase (					self  :   Optional[int]      ,      lowerCAmelCase  :   Any      ,      lowerCAmelCase  :   Any=None   )	-> int:
        if color is None:
          a__     		=     self.edgecolor
        ((a__)		,(a__)		,(a__)		,(a__))     		=     box
        a__     		=     xa - xa
        a__     		=     ya - ya
        self.ax.add_patch(
            mpl.patches.Rectangle(
                (xa, ya)      ,      lowerCAmelCase      ,      lowerCAmelCase      ,      fill=lowerCAmelCase      ,      edgecolor=lowerCAmelCase      ,      linewidth=self.font_size // 3      ,      alpha=self.alpha      ,      linestyle=self.linestyle      ,      )   )
  
  
  
  
      def 						__lowerCamelCase (					self  :   Any      ,      lowerCAmelCase  :   Dict      ,      lowerCAmelCase  :   Dict=None      ,      lowerCAmelCase  :   Optional[int]=None      ,      lowerCAmelCase  :   Optional[int]=None      ,      lowerCAmelCase  :   List[Any]=None   )	-> List[Any]:
        if len(boxes.shape   ) > 2:
          a__     		=     boxes[0]
        if len(obj_ids.shape   ) > 1:
          a__     		=     obj_ids[0]
        if len(obj_scores.shape   ) > 1:
          a__     		=     obj_scores[0]
        if len(attr_ids.shape   ) > 1:
          a__     		=     attr_ids[0]
        if len(attr_scores.shape   ) > 1:
          a__     		=     attr_scores[0]
        if isinstance(lowerCAmelCase      ,      torch.Tensor   ):
          a__     		=     boxes.numpy()
        if isinstance(lowerCAmelCase      ,      lowerCAmelCase   ):
          a__     		=     np.array(lowerCAmelCase   )
        assert isinstance(lowerCAmelCase      ,      np.ndarray   )
        a__     		=     np.prod(boxes[:, 2:] - boxes[:, :2]      ,      axis=1   )
        a__     		=     np.argsort(-areas   ).tolist()
        a__     		=     boxes[sorted_idxs] if boxes is not None else None
        a__     		=     obj_ids[sorted_idxs] if obj_ids is not None else None
        a__     		=     obj_scores[sorted_idxs] if obj_scores is not None else None
        a__     		=     attr_ids[sorted_idxs] if attr_ids is not None else None
        a__     		=     attr_scores[sorted_idxs] if attr_scores is not None else None
  
        a__     		=     [self._random_color(maximum=1   ) for _ in range(len(lowerCAmelCase   )   )]
        a__     		=     [assigned_colors[idx] for idx in sorted_idxs]
        if obj_ids is not None:
          a__     		=     self._create_text_labels_attr(lowerCAmelCase      ,      lowerCAmelCase      ,      lowerCAmelCase      ,      lowerCAmelCase   )
          for i in range(len(lowerCAmelCase   )   ):
            a__     		=     assigned_colors[i]
            self.add_box(boxes[i]      ,      lowerCAmelCase   )
            self.draw_labels(labels[i]      ,      boxes[i]      ,      lowerCAmelCase   )
  
  
  
  
      def 						__lowerCamelCase (					self  :   List[Any]      ,      lowerCAmelCase  :   Tuple      ,      lowerCAmelCase  :   Optional[int]      ,      lowerCAmelCase  :   Optional[int]   )	-> Dict:
        a__		,a__		,a__		,a__     		=     box
        a__     		=     (xa, ya)
        a__     		=     (ya - ya) * (xa - xa)
        a__     		=     _SMALL_OBJ * self.scale
        if instance_area < small or ya - ya < 40 * self.scale:
          if ya >= self.height - 5:
            a__     		=     (xa, ya)
          else:
            a__     		=     (xa, ya)
  
        a__     		=     (ya - ya) / np.sqrt(self.height * self.width   )
        a__     		=     self._change_color_brightness(lowerCAmelCase      ,      brightness_factor=0.7   )
        a__     		=     np.clip((height_ratio - 0.02) / 0.08 + 1      ,      1.2      ,      2   )
        font_size *= 0.75 * self.font_size
  
        self.draw_text(
            text=lowerCAmelCase      ,      position=lowerCAmelCase      ,      color=lowerCAmelCase      ,      )
  
  
  
  
      def 						__lowerCamelCase (					self  :   List[str]      ,      lowerCAmelCase  :   int      ,      lowerCAmelCase  :   Union[str, Any]      ,      lowerCAmelCase  :   str="g"      ,      lowerCAmelCase  :   Tuple="left"      ,      )	-> List[Any]:
        a__     		=     0
        a__     		=     self.font_size
        a__     		=     np.maximum(list(mplc.to_rgb(lowerCAmelCase   )   )      ,      0.2   )
        a__     		=     max(0.8      ,      np.max(lowerCAmelCase   )   )
        a__     		=     {
            "facecolor": "black",
            "alpha": self.alpha,
            "pad": self.pad,
            "edgecolor": "none",
        }
        a__		,a__     		=     position
        self.ax.text(
            lowerCAmelCase      ,      lowerCAmelCase      ,      lowerCAmelCase      ,      size=font_size * self.scale      ,      family="sans-serif"      ,      bbox=lowerCAmelCase      ,      verticalalignment="top"      ,      horizontalalignment=lowerCAmelCase      ,      color=lowerCAmelCase      ,      zorder=10      ,      rotation=lowerCAmelCase      ,      )
  
  
  
  
      def 						__lowerCamelCase (					self  :   Tuple      ,      lowerCAmelCase  :   Dict=None   )	-> Union[str, Any]:
        if saveas is None:
          a__     		=     self.saveas
        if saveas.lower().endswith(".jpg"   ) or saveas.lower().endswith(".png"   ):
          cva.imwrite(
              lowerCAmelCase      ,      self._get_buffer()[:, :, ::-1]      ,      )
        else:
          self.fig.savefig(lowerCAmelCase   )
  
  
  
  
      def 						__lowerCamelCase (					self  :   int      ,      lowerCAmelCase  :   int      ,      lowerCAmelCase  :   Union[str, Any]      ,      lowerCAmelCase  :   Any      ,      lowerCAmelCase  :   Tuple   )	-> Optional[int]:
        a__     		=     [self.idaobj[i] for i in classes]
        a__     		=     [self.idaattr[i] for i in attr_classes]
        a__     		=     [
            f"{label} {score:.2f} {attr} {attr_score:.2f}"
            for label, score, attr, attr_score in zip(lowerCAmelCase      ,      lowerCAmelCase      ,      lowerCAmelCase      ,      lowerCAmelCase   )
        ]
        return labels
  
  
  
  
      def 						__lowerCamelCase (					self  :   Union[str, Any]      ,      lowerCAmelCase  :   List[Any]      ,      lowerCAmelCase  :   Tuple   )	-> Dict:
        a__     		=     [self.idaobj[i] for i in classes]
        if scores is not None:
          if labels is None:
            a__     		=     ["{:.0f}%".format(s * 100   ) for s in scores]
          else:
            a__     		=     ["{} {:.0f}%".format(lowerCAmelCase      ,      s * 100   ) for li, s in zip(lowerCAmelCase      ,      lowerCAmelCase   )]
        return labels
  
  
  
  
      def 						__lowerCamelCase (					self  :   Optional[Any]      ,      lowerCAmelCase  :   str=255   )	-> Union[str, Any]:
        a__     		=     np.random.randint(0      ,      len(_COLORS   )   )
        a__     		=     _COLORS[idx] * maximum
        if not self.rgb:
          a__     		=     ret[::-1]
        return ret
  
  
  
  
      def 						__lowerCamelCase (					self  :   Tuple   )	-> Dict:
        if not self.pynb:
          a__		,a__     		=     self.canvas.print_to_buffer()
          if (width, height) != (self.width, self.height):
            a__     		=     cva.resize(self.img      ,      (width, height)   )
          else:
            a__     		=     self.img
        else:
          a__     		=     io.BytesIO()  # works for cairo backend
          self.canvas.print_rgba(lowerCAmelCase   )
          a__		,a__     		=     self.width, self.height
          a__     		=     buf.getvalue()
          a__     		=     self.img
  
        a__     		=     np.frombuffer(lowerCAmelCase      ,      dtype="uint8"   )
        a__     		=     buffer.reshape(lowerCAmelCase      ,      lowerCAmelCase      ,      4   )
        a__		,a__     		=     np.split(lowerCAmelCase      ,      [3]      ,      axis=2   )
  
        try:
          import numexpr as ne  # fuse them with numexpr
  
          a__     		=     ne.evaluate("img * (1 - alpha / 255.0) + rgb * (alpha / 255.0)"   )
        except ImportError:
          a__     		=     alpha.astype("float32"   ) / 255.0
          a__     		=     img * (1 - alpha) + rgb * alpha
  
        return visualized_image.astype("uint8"   )
  
  
  
  
      def 						__lowerCamelCase (					self  :   Tuple      ,      lowerCAmelCase  :   Any      ,      lowerCAmelCase  :   str   )	-> Any:
        assert brightness_factor >= -1.0 and brightness_factor <= 1.0
        a__     		=     mplc.to_rgb(lowerCAmelCase   )
        a__     		=     colorsys.rgb_to_hls(*mplc.to_rgb(lowerCAmelCase   )   )
        a__     		=     polygon_color[1] + (brightness_factor * polygon_color[1])
        a__     		=     0.0 if modified_lightness < 0.0 else modified_lightness
        a__     		=     1.0 if modified_lightness > 1.0 else modified_lightness
        a__     		=     colorsys.hls_to_rgb(polygon_color[0]      ,      lowerCAmelCase      ,      polygon_color[2]   )
        return modified_color
  
  _SCREAMING_SNAKE_CASE   						=    (
      np.array(
          [
              0.000,
              0.447,
              0.741,
              0.850,
              0.325,
              0.098,
              0.929,
              0.694,
              0.125,
              0.494,
              0.184,
              0.556,
              0.466,
              0.674,
              0.188,
              0.301,
              0.745,
              0.933,
              0.635,
              0.078,
              0.184,
              0.300,
              0.300,
              0.300,
              0.600,
              0.600,
              0.600,
              1.000,
              0.000,
              0.000,
              1.000,
              0.500,
              0.000,
              0.749,
              0.749,
              0.000,
              0.000,
              1.000,
              0.000,
              0.000,
              0.000,
              1.000,
              0.667,
              0.000,
              1.000,
              0.333,
              0.333,
              0.000,
              0.333,
              0.667,
              0.000,
              0.333,
              1.000,
              0.000,
              0.667,
              0.333,
              0.000,
              0.667,
              0.667,
              0.000,
              0.667,
              1.000,
              0.000,
              1.000,
              0.333,
              0.000,
              1.000,
              0.667,
              0.000,
              1.000,
              1.000,
              0.000,
              0.000,
              0.333,
              0.500,
              0.000,
              0.667,
              0.500,
              0.000,
              1.000,
              0.500,
              0.333,
              0.000,
              0.500,
              0.333,
              0.333,
              0.500,
              0.333,
              0.667,
              0.500,
              0.333,
              1.000,
              0.500,
              0.667,
              0.000,
              0.500,
              0.667,
              0.333,
              0.500,
              0.667,
              0.667,
              0.500,
              0.667,
              1.000,
              0.500,
              1.000,
              0.000,
              0.500,
              1.000,
              0.333,
              0.500,
              1.000,
              0.667,
              0.500,
              1.000,
              1.000,
              0.500,
              0.000,
              0.333,
              1.000,
              0.000,
              0.667,
              1.000,
              0.000,
              1.000,
              1.000,
              0.333,
              0.000,
              1.000,
              0.333,
              0.333,
              1.000,
              0.333,
              0.667,
              1.000,
              0.333,
              1.000,
              1.000,
              0.667,
              0.000,
              1.000,
              0.667,
              0.333,
              1.000,
              0.667,
              0.667,
              1.000,
              0.667,
              1.000,
              1.000,
              1.000,
              0.000,
              1.000,
              1.000,
              0.333,
              1.000,
              1.000,
              0.667,
              1.000,
              0.333,
              0.000,
              0.000,
              0.500,
              0.000,
              0.000,
              0.667,
              0.000,
              0.000,
              0.833,
              0.000,
              0.000,
              1.000,
              0.000,
              0.000,
              0.000,
              0.167,
              0.000,
              0.000,
              0.333,
              0.000,
              0.000,
              0.500,
              0.000,
              0.000,
              0.667,
              0.000,
              0.000,
              0.833,
              0.000,
              0.000,
              1.000,
              0.000,
              0.000,
              0.000,
              0.167,
              0.000,
              0.000,
              0.333,
              0.000,
              0.000,
              0.500,
              0.000,
              0.000,
              0.667,
              0.000,
              0.000,
              0.833,
              0.000,
              0.000,
              1.000,
              0.000,
              0.000,
              0.000,
              0.143,
              0.143,
              0.143,
              0.857,
              0.857,
              0.857,
              1.000,
              1.000,
              1.000,
          ]
      )
      .astype(np.floataa)
      .reshape(-1, 3)
  )
  
  
style_context: def 				__lowercase	(						lowerCamelCase__ ,				lowerCamelCase__					)				->Optional[int]:
  
    '''simple docstring'''
  
  
  
  
    sequence.append(lowerCamelCase__					)
  
    a__     		=     0
    while sequence[index] != target:
      index += 1
  
    sequence.pop()
  
    if index == len(lowerCamelCase__					):
      return None
  
    return index
  
  
  if __name__ == "__main__":
       _SCREAMING_SNAKE_CASE   						=    input("""Enter numbers separated by comma:\n""").strip()
       _SCREAMING_SNAKE_CASE   						=    [int(item) for item in user_input.split(""",""")]
  
       _SCREAMING_SNAKE_CASE   						=    input("""Enter a single number to be found in the list:\n""")
       _SCREAMING_SNAKE_CASE   						=    int(target_input)
       _SCREAMING_SNAKE_CASE   						=    sentinel_linear_search(sequence, target)
       if result is not None:
            print(F"""{target} found at positions: {result}""")
       else:
            print("""Not found""")
  
  