

"""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        SCREAMING_SNAKE_CASE      (	unittest.TestCase					,							a_ ):






					"""simple docstring"""



					def  __lowerCAmelCase				( self    :       Optional[Any]	):
						lowerCAmelCase__			:		List[str]						       =			load_tool('''image-segmentation'''	)
						self.tool.setup()
						lowerCAmelCase__			:		Union[str, Any]						       =			load_tool('''image-segmentation'''     ,remote=lowercase_	)







					def  __lowerCAmelCase				( self    :       Dict	):
						lowerCAmelCase__			:		List[str]						       =			Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''	)	) / '''000000039769.png'''	)
						lowerCAmelCase__			:		Dict						       =			self.tool(lowercase_     ,'''cat'''	)
						self.assertTrue(isinstance(lowercase_     ,Image.Image	)	)







					def  __lowerCAmelCase				( self    :       str	):
						lowerCAmelCase__			:		Optional[Any]						       =			Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''	)	) / '''000000039769.png'''	)
						lowerCAmelCase__			:		List[Any]						       =			self.remote_tool(lowercase_     ,'''cat'''	)
						self.assertTrue(isinstance(lowercase_     ,Image.Image	)	)







					def  __lowerCAmelCase				( self    :       List[Any]	):
						lowerCAmelCase__			:		Optional[int]						       =			Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''	)	) / '''000000039769.png'''	)
						lowerCAmelCase__			:		List[Any]						       =			self.tool(image=lowercase_     ,label='''cat'''	)
						self.assertTrue(isinstance(lowercase_     ,Image.Image	)	)







					def  __lowerCAmelCase				( self    :       Optional[Any]	):
						lowerCAmelCase__			:		Optional[Any]						       =			Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''	)	) / '''000000039769.png'''	)
						lowerCAmelCase__			:		Dict						       =			self.remote_tool(image=lowercase_     ,label='''cat'''	)
						self.assertTrue(isinstance(lowercase_     ,Image.Image	)	)







"""simple docstring"""





def 						__SCREAMING_SNAKE_CASE						(   A_				):
	lowerCAmelCase__			:		List[Any]						       =			53_81
	for x in s:
		lowerCAmelCase__			:		Tuple						       =			((hash_value << 5) + hash_value) + ord(A_				)
	return hash_value & 0Xf_f_f_f_f_f_f_f




