

class      lowerCamelCase_ :


 class      lowerCamelCase_ :
  _lowerCAmelCase									=	'''_prev''', '''_data''', '''_next'''




  def __init__(			self  ,  _UpperCAmelCase  ,  _UpperCAmelCase  ,  _UpperCAmelCase							):
    __UpperCAmelCase	:  Optional[Any]		=     link_p
    __UpperCAmelCase	:  Tuple		=     element
    __UpperCAmelCase	:  Dict		=     link_n




  def     a       (			self							):
    return (
        F" Prev -> {self._prev is not None}, Next -> {self._next is not None}"
    )




 def __init__(			self							):
   __UpperCAmelCase	:  Union[str, Any]		=     self._Node(_UpperCAmelCase  ,  _UpperCAmelCase  ,  _UpperCAmelCase							)
   __UpperCAmelCase	:  Dict		=     self._Node(_UpperCAmelCase  ,  _UpperCAmelCase  ,  _UpperCAmelCase							)
   __UpperCAmelCase	:  Dict		=     self._trailer
   __UpperCAmelCase	:  Optional[int]		=     self._header
   __UpperCAmelCase	:  List[str]		=     0




 def __len__(			self							):
   return self._size




 def     a       (			self							):
   return self.__len__() == 0




 def     a       (			self  ,  _UpperCAmelCase  ,  _UpperCAmelCase  ,  _UpperCAmelCase							):
   # Create new_node by setting it's prev.link -> header
   # setting it's next.link -> trailer
   __UpperCAmelCase	:  Union[str, Any]		=     self._Node(_UpperCAmelCase  ,  _UpperCAmelCase  ,  _UpperCAmelCase							)
   __UpperCAmelCase	:  Union[str, Any]		=     new_node
   __UpperCAmelCase	:  Tuple		=     new_node
   self._size += 1
   return self




 def     a       (			self  ,  _UpperCAmelCase							):
   __UpperCAmelCase	:  Optional[Any]		=     node._prev
   __UpperCAmelCase	:  Dict		=     node._next

   __UpperCAmelCase	:  Optional[int]		=     successor
   __UpperCAmelCase	:  Optional[int]		=     predecessor
   self._size -= 1
   __UpperCAmelCase	:  List[Any]		=     node._data
   __UpperCAmelCase	:  int		=     None
   del node
   return temp



class      lowerCamelCase_ (			_DoublyLinkedBase):




 def     a       (			self							):
   if self.is_empty():
     raise Exception('List is empty'							)
   return self._header._next._data




 def     a       (			self							):
   if self.is_empty():
     raise Exception('List is empty'							)
   return self._trailer._prev._data




 def     a       (			self  ,  _UpperCAmelCase							):
   return self._insert(self._header  ,  _UpperCAmelCase  ,  self._header._next							)




 def     a       (			self  ,  _UpperCAmelCase							):
   return self._insert(self._trailer._prev  ,  _UpperCAmelCase  ,  self._trailer							)




 def     a       (			self							):
   if self.is_empty():
     raise IndexError('remove_first from empty list'							)
   return self._delete(self._header._next							)




 def     a       (			self							):
   if self.is_empty():
     raise IndexError('remove_first from empty list'							)
   return self._delete(self._trailer._prev							)













'''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 _lowercase      (							unittest.TestCase							, _lowercase						):




							def 						lowerCamelCase_							(				self:							Tuple	):
														lowerCamelCase__   :      Optional[Any]			    =			load_tool("""image-captioning"""	)
														self.tool.setup()
														lowerCamelCase__   :      Optional[Any]			    =			load_tool("""image-captioning"""     ,				remote=UpperCamelCase__	)




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




							def 						lowerCamelCase_							(				self:							Union[str, Any]	):
														lowerCamelCase__   :      Tuple			    =			Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
														lowerCamelCase__   :      Dict			    =			self.remote_tool(UpperCamelCase__	)
														self.assertEqual(UpperCamelCase__     ,				"""two cats sleeping on a couch"""	)




							def 						lowerCamelCase_							(				self:							str	):
														lowerCamelCase__   :      Optional[int]			    =			Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
														lowerCamelCase__   :      str			    =			self.tool(image=UpperCamelCase__	)
														self.assertEqual(UpperCamelCase__     ,				"""two cats sleeping on a couch"""	)




							def 						lowerCamelCase_							(				self:							Union[str, Any]	):
														lowerCamelCase__   :      Optional[int]			    =			Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""	)	) / """000000039769.png"""	)
														lowerCamelCase__   :      Optional[int]			    =			self.remote_tool(image=UpperCamelCase__	)
														self.assertEqual(UpperCamelCase__     ,				"""two cats sleeping on a couch"""	)

