




'''simple docstring'''





from collections import deque

from .hash_table import HashTable




class 			_snake_case		(     lowercase_							):




			def __init__( self    ,							*a__    ,							**a__							)    ->    List[str]:

										'''simple docstring'''




										super().__init__(*a__    ,							**a__							)




			def        lowerCAmelCase__    ( self    ,							a__    ,							a__							)    ->    List[Any]:

										'''simple docstring'''




										snake_case_      =				deque([]							) if self.values[key] is None else self.values[key]
										self.values[key].appendleft(a__							)
										snake_case_      =				self.values[key]




			def        lowerCAmelCase__    ( self							)    ->    Union[str, Any]:

										'''simple docstring'''




										return (
										    sum(self.charge_factor - len(a__							) for slot in self.values							)
										    / self.size_table
										    * self.charge_factor
										)




			def        lowerCAmelCase__    ( self    ,							a__    ,							a__=None							)    ->    Dict:

										'''simple docstring'''




										if not (
										    len(self.values[key]							) == self.charge_factor and self.values.count(a__							) == 0
										):
																	return key
										return super()._collision_resolution(a__    ,							a__							)










'''simple docstring'''





import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin




class 			_snake_case		(     unittest.TestCase						,						lowercase_							):




			def        lowerCAmelCase__    ( self							)    ->    Optional[int]:

										'''simple docstring'''




										snake_case_      =				load_tool("text-classification"							)
										self.tool.setup()
										snake_case_      =				load_tool("text-classification"    ,							remote=a__							)




			def        lowerCAmelCase__    ( self							)    ->    str:

										'''simple docstring'''




										snake_case_      =				self.tool("That's quite cool"    ,							["positive", "negative"]							)
										self.assertEqual(a__    ,							"positive"							)




			def        lowerCAmelCase__    ( self							)    ->    Optional[int]:

										'''simple docstring'''




										snake_case_      =				self.remote_tool("That's quite cool"    ,							["positive", "negative"]							)
										self.assertEqual(a__    ,							"positive"							)




			def        lowerCAmelCase__    ( self							)    ->    int:

										'''simple docstring'''




										snake_case_      =				self.tool(text="That's quite cool"    ,							labels=["positive", "negative"]							)
										self.assertEqual(a__    ,							"positive"							)




			def        lowerCAmelCase__    ( self							)    ->    Any:

										'''simple docstring'''




										snake_case_      =				self.remote_tool(text="That's quite cool"    ,							labels=["positive", "negative"]							)
										self.assertEqual(a__    ,							"positive"							)




