'''simple docstring'''




class   _lowercase:



   """simple docstring"""





   class   _lowercase:



      """simple docstring"""





      __lowerCamelCase    =  """_prev""", """_data""", """_next"""





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





      def 			snake_case	(							self:    Optional[int]	):
       return (
           f""" Prev -> {self._prev is not None}, Next -> {self._next is not None}"""
       )





   def __init__(							self:    Tuple	):
    __UpperCAmelCase         =					self._Node(_A			,_A			,_A	)
    __UpperCAmelCase         =					self._Node(_A			,_A			,_A	)
    __UpperCAmelCase         =					self._trailer
    __UpperCAmelCase         =					self._header
    __UpperCAmelCase         =					0





   def __len__(							self:    Union[str, Any]	):
    return self._size





   def 			snake_case	(							self:    Optional[int]	):
    return self.__len__() == 0





   def 			snake_case	(							self:    List[Any]			,a:    List[Any]			,a:    Dict			,a:    int	):
    # Create new_node by setting it's prev.link -> header
    # setting it's next.link -> trailer
    __UpperCAmelCase         =					self._Node(_A			,_A			,_A	)
    __UpperCAmelCase         =					new_node
    __UpperCAmelCase         =					new_node
    self._size += 1
    return self





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

    __UpperCAmelCase         =					successor
    __UpperCAmelCase         =					predecessor
    self._size -= 1
    __UpperCAmelCase         =					node._data
    __UpperCAmelCase         =					None
    del node
    return temp




class   _lowercase(     _DoublyLinkedBase				):



   """simple docstring"""





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





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





   def 			snake_case	(							self:    Tuple			,a:    List[str]	):
    return self._insert(self._header			,_A			,self._header._next	)





   def 			snake_case	(							self:    Union[str, Any]			,a:    Dict	):
    return self._insert(self._trailer._prev			,_A			,self._trailer	)





   def 			snake_case	(							self:    Optional[int]	):
    if self.is_empty():
     raise IndexError('remove_first from empty list'	)
    return self._delete(self._header._next	)





   def 			snake_case	(							self:    Union[str, Any]	):
    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   ,_lowerCamelCase				):



   """simple docstring"""





   def 			snake_case	(							self:    Optional[int]	):
    __UpperCAmelCase         =					load_tool('image-captioning'	)
    self.tool.setup()
    __UpperCAmelCase         =					load_tool('image-captioning'			,remote=a	)





   def 			snake_case	(							self:    List[Any]	):
    __UpperCAmelCase         =					Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'	)	) / '000000039769.png'	)
    __UpperCAmelCase         =					self.tool(a	)
    self.assertEqual(a			,'two cats sleeping on a couch'	)





   def 			snake_case	(							self:    List[Any]	):
    __UpperCAmelCase         =					Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'	)	) / '000000039769.png'	)
    __UpperCAmelCase         =					self.remote_tool(a	)
    self.assertEqual(a			,'two cats sleeping on a couch'	)





   def 			snake_case	(							self:    Optional[Any]	):
    __UpperCAmelCase         =					Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'	)	) / '000000039769.png'	)
    __UpperCAmelCase         =					self.tool(image=a	)
    self.assertEqual(a			,'two cats sleeping on a couch'	)





   def 			snake_case	(							self:    Tuple	):
    __UpperCAmelCase         =					Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'	)	) / '000000039769.png'	)
    __UpperCAmelCase         =					self.remote_tool(image=a	)
    self.assertEqual(a			,'two cats sleeping on a couch'	)



