
'''simple docstring'''

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       ,					__a				):



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Dict         =    load_tool("""image-captioning"""	)
          self.tool.setup()
          _UpperCAmelCase					:  int         =    load_tool("""image-captioning"""						,	remote=lowerCAmelCase__	)



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Any         =    Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
          _UpperCAmelCase					:  Optional[Any]         =    self.tool(lowerCAmelCase__	)
          self.assertEqual(lowerCAmelCase__						,	"""two cats sleeping on a couch"""	)



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Optional[Any]         =    Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
          _UpperCAmelCase					:  Optional[Any]         =    self.remote_tool(lowerCAmelCase__	)
          self.assertEqual(lowerCAmelCase__						,	"""two cats sleeping on a couch"""	)



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Optional[Any]         =    Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
          _UpperCAmelCase					:  List[Any]         =    self.tool(image=lowerCAmelCase__	)
          self.assertEqual(lowerCAmelCase__						,	"""two cats sleeping on a couch"""	)



     def     snake_case_ (self	):
          _UpperCAmelCase					:  Tuple         =    Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
          _UpperCAmelCase					:  List[str]         =    self.remote_tool(image=lowerCAmelCase__	)
          self.assertEqual(lowerCAmelCase__						,	"""two cats sleeping on a couch"""	)




'''simple docstring'''

from itertools import combinations, product







def __A  (    lowerCAmelCase_ ,       lowerCAmelCase_ ,       lowerCAmelCase_ ,       lowerCAmelCase_       ):
     if xa == ya == 0 or xa == ya == 0:
          return False
     _UpperCAmelCase					:  Any         =    xa * xa + ya * ya
     _UpperCAmelCase					:  Any         =    xa * xa + ya * ya
     _UpperCAmelCase					:  Tuple         =    (xa - xa) * (xa - xa) + (ya - ya) * (ya - ya)
     return (
         a_square + b_square == c_square
         or a_square + c_square == b_square
         or b_square + c_square == a_square
     )







def __A  (    lowerCAmelCase_ = 50       ):
     return sum(
         1
         for pta, pta in combinations(product(range(limit + 1       ) ,       repeat=2       ) ,       2       )
         if is_right(*lowerCAmelCase_ ,       *lowerCAmelCase_       )       )


if __name__ == "__main__":
   print(F"{solution() = }")


