code: 
  
  
  from __future__ import annotations
  
  from collections.abc import Iterable
  from dataclasses import dataclass
  from typing import Any
  
  
  
  
  
  
  
  class   lowerCAmelCase__ :
  
  
  
  
       '''simple docstring'''
       __SCREAMING_SNAKE_CASE						    =				("_front", "_back", "_len")
  
  
  
  
  
  
  
       @dataclass
       class   lowerCAmelCase__ :
  
  
  
  
            '''simple docstring'''
            __SCREAMING_SNAKE_CASE						    =				None
            __SCREAMING_SNAKE_CASE						    =				None
            __SCREAMING_SNAKE_CASE						    =				None
  
  
  
  
  
  
  
       class   lowerCAmelCase__ :
  
  
  
  
            '''simple docstring'''
            __SCREAMING_SNAKE_CASE						    =				("_cur",)
  
  
            def __init__(		self				,		__lowerCamelCase)    ->       None:
                   _A   : Union[str, Any]       					=				cur
  
  
            def __iter__(		self)    ->       Deque._Iterator:
                   return self
  
  
            def 				_lowerCamelCase				(		self)    ->       Any:
                   if self._cur is None:
                          # finished iterating
                          raise StopIteration
                   _A   : List[Any]       					=				self._cur.val
                   _A   : List[Any]       					=				self._cur.next_node
  
                   return val
  
  
  
  
       def __init__(		self				,		__lowerCamelCase = None)    ->       None:
              _A   : Any       					=				None
              _A   : Any       					=				None
              _A   : int       					=				0
  
              if iterable is not None:
                     # append every value to the deque
                     for val in iterable:
                            self.append(__lowerCamelCase)
  
  
       def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       None:
              _A   : int       					=				self._Node(__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase)
              if self.is_empty():
                     # front = back
                     _A   : int       					=				node
                     _A   : Optional[Any]       					=				1
              else:
                     # connect nodes
                     _A   : Optional[int]       					=				node
                     _A   : List[str]       					=				self._back
                     _A   : str       					=				node  # assign new back to the new node
  
                     self._len += 1
  
                     # make sure there were no errors
                     assert not self.is_empty(), "Error on appending value."
  
  
       def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       None:
              _A   : Tuple       					=				self._Node(__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase)
              if self.is_empty():
                     # front = back
                     _A   : Optional[Any]       					=				node
                     _A   : Optional[Any]       					=				1
              else:
                     # connect nodes
                     _A   : Any       					=				self._front
                     _A   : Any       					=				node
                     _A   : Any       					=				node  # assign new front to the new node
  
                     self._len += 1
  
                     # make sure there were no errors
                     assert not self.is_empty(), "Error on appending value."
  
  
       def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       None:
              for val in iterable:
                     self.append(__lowerCamelCase)
  
  
       def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       None:
              for val in iterable:
                     self.appendleft(__lowerCamelCase)
  
  
       def 				_lowerCamelCase				(		self)    ->       Any:
              assert not self.is_empty(), "Deque is empty."
  
              _A   : Optional[Any]       					=				self._back
              _A   : Optional[int]       					=				self._back.prev_node  # set new back
              # drop the last node - python will deallocate memory automatically
              _A   : List[str]       					=				None
  
              self._len -= 1
  
              return topop.val
  
  
       def 				_lowerCamelCase				(		self)    ->       Any:
              assert not self.is_empty(), "Deque is empty."
  
              _A   : Dict       					=				self._front
              _A   : List[str]       					=				self._front.next_node  # set new front and drop the first node
              _A   : Dict       					=				None
  
              self._len -= 1
  
              return topop.val
  
  
       def 				_lowerCamelCase				(		self)    ->       bool:
              return self._front is None
  
  
       def __len__(		self)    ->       int:
              return self._len
  
  
       def __eq__(		self				,		__lowerCamelCase)    ->       bool:
  
              if not isinstance(__lowerCamelCase				,		__lowerCamelCase):
                     return NotImplemented
  
              _A   : List[Any]       					=				self._front
              _A   : str       					=				other._front
  
              # if the length of the dequeues are not the same, they are not equal
              if len(self) != len(__lowerCamelCase):
                     return False
  
              while me is not None and oth is not None:
                     # compare every value
                     if me.val != oth.val:
                            return False
                     _A   : int       					=				me.next_node
                     _A   : str       					=				oth.next_node
  
              return True
  
  
       def __iter__(		self)    ->       Deque._Iterator:
              return Deque._Iterator(self._front)
  
  
       def __repr__(		self)    ->       str:
              _A   : str       					=				[]
              _A   : Dict       					=				self._front
              while aux is not None:
                     # append the values in a list to display
                     values_list.append(aux.val)
                     _A   : int       					=				aux.next_node
  
              return F"[{', '.join(repr(__lowerCamelCase) for val in values_list)}]"
  
  
  if __name__ == "__main__":
      import doctest
  
      doctest.testmod()
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_tf_available,
      is_torch_available,
      is_vision_available,
  )
  
  
  lowerCAmelCase__   	=				{
      'configuration_segformer': ['SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SegformerConfig', 'SegformerOnnxConfig']
  }
  
  try:
      if not is_vision_available():
          raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
      pass
  else:
      lowerCAmelCase__   	=				['SegformerFeatureExtractor']
      lowerCAmelCase__   	=				['SegformerImageProcessor']
  
  try:
      if not is_torch_available():
          raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
      pass
  else:
      lowerCAmelCase__   	=				[
          'SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
          'SegformerDecodeHead',
          'SegformerForImageClassification',
          'SegformerForSemanticSegmentation',
          'SegformerLayer',
          'SegformerModel',
          'SegformerPreTrainedModel',
      ]
  
  try:
      if not is_tf_available():
          raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
      pass
  else:
      lowerCAmelCase__   	=				[
          'TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
          'TFSegformerDecodeHead',
          'TFSegformerForImageClassification',
          'TFSegformerForSemanticSegmentation',
          'TFSegformerModel',
          'TFSegformerPreTrainedModel',
      ]
  
  
  if TYPE_CHECKING:
      from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig
  
      try:
          if not is_vision_available():
              raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
          pass
      else:
          from .feature_extraction_segformer import SegformerFeatureExtractor
          from .image_processing_segformer import SegformerImageProcessor
  
      try:
          if not is_torch_available():
              raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
          pass
      else:
          from .modeling_segformer import (
              SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
              SegformerDecodeHead,
              SegformerForImageClassification,
              SegformerForSemanticSegmentation,
              SegformerLayer,
              SegformerModel,
              SegformerPreTrainedModel,
          )
      try:
          if not is_tf_available():
              raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
          pass
      else:
          from .modeling_tf_segformer import (
              TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFSegformerDecodeHead,
              TFSegformerForImageClassification,
              TFSegformerForSemanticSegmentation,
              TFSegformerModel,
              TFSegformerPreTrainedModel,
          )
  
  else:
      import sys
  
      lowerCAmelCase__   	=				_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
  