




def    UpperCAmelCase__	(  lowerCamelCase ):
  return -num if num < 0 else num



def    UpperCAmelCase__	(  lowerCamelCase ):
  if len(lowerCamelCase ) == 0:
    raise ValueError("abs_min() arg is an empty sequence" )
  lowercase     :int   						=    x[0]
  for i in x:
    if abs_val(lowerCamelCase ) < abs_val(lowerCamelCase ):
      lowercase     :Any   						=    i
  return j



def    UpperCAmelCase__	(  lowerCamelCase ):
  if len(lowerCamelCase ) == 0:
    raise ValueError("abs_max() arg is an empty sequence" )
  lowercase     :Optional[Any]   						=    x[0]
  for i in x:
    if abs(lowerCamelCase ) > abs(lowerCamelCase ):
      lowercase     :Optional[Any]   						=    i
  return j



def    UpperCAmelCase__	(  lowerCamelCase ):
  if len(lowerCamelCase ) == 0:
    raise ValueError("abs_max_sort() arg is an empty sequence" )
  return sorted(lowerCamelCase,      key=lowerCamelCase )[-1]



def    UpperCAmelCase__	(  ):
  assert abs_val(0 ) == 0
  assert abs_val(34 ) == 34
  assert abs_val(-100000000000 ) == 100000000000

  lowercase     :Optional[Any]   						=    [-3, -1, 2, -11]
  assert abs_max(lowerCamelCase ) == -11
  assert abs_max_sort(lowerCamelCase ) == -11
  assert abs_min(lowerCamelCase ) == -1


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     test_abs_val()
     print(abs_val(-34))  # --> 34









import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
     from PIL import Image




class  __lowerCAmelCase							(				unittest.TestCase   ,			lowerCAmelCase):






       def        SCREAMING_SNAKE_CASE     ( self:       Dict					):
         lowercase     :Any   						=    load_tool("image-segmentation"					)
         self.tool.setup()
         lowercase     :int   						=    load_tool("image-segmentation"							,       remote=_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       str					):
         lowercase     :Any   						=    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
         lowercase     :Dict   						=    self.tool(_lowerCAmelCase							,       "cat"					)
         self.assertTrue(isinstance(_lowerCAmelCase							,       Image.Image					)					)






       def        SCREAMING_SNAKE_CASE     ( self:       Union[str, Any]					):
         lowercase     :Dict   						=    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
         lowercase     :List[Any]   						=    self.remote_tool(_lowerCAmelCase							,       "cat"					)
         self.assertTrue(isinstance(_lowerCAmelCase							,       Image.Image					)					)






       def        SCREAMING_SNAKE_CASE     ( self:       List[Any]					):
         lowercase     :Optional[Any]   						=    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
         lowercase     :Dict   						=    self.tool(image=_lowerCAmelCase							,       label="cat"					)
         self.assertTrue(isinstance(_lowerCAmelCase							,       Image.Image					)					)






       def        SCREAMING_SNAKE_CASE     ( self:       Tuple					):
         lowercase     :int   						=    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"					)					) / "000000039769.png"					)
         lowercase     :List[str]   						=    self.remote_tool(image=_lowerCAmelCase							,       label="cat"					)
         self.assertTrue(isinstance(_lowerCAmelCase							,       Image.Image					)					)



