



class 					snake_case__						:






     """simple docstring"""


     def __init__(       self  :  Optional[int], _snake_case  :  int, _snake_case  :  Union[str, Any]=None, _snake_case  :  List[Any]=None					)   ->Optional[Any]:
            snake_case__							:	Dict   	=	data
            snake_case__							:	int   	=	previous
            snake_case__							:	Tuple   	=	next_node






     def __str__(       self  :  Optional[Any]					)   ->str:
            return F'''{self.data}'''






     def    lowercase_   (       self  :  List[Any]					)   ->int:
            return self.data






     def    lowercase_   (       self  :  Any					)   ->Dict:
            return self.next






     def    lowercase_   (       self  :  Any					)   ->int:
            return self.previous




class 					snake_case__						:






     """simple docstring"""


     def __init__(       self  :  Optional[Any], _snake_case  :  List[Any]					)   ->Any:
            snake_case__							:	int   	=	head






     def __iter__(       self  :  Dict					)   ->int:
            return self






     def    lowercase_   (       self  :  List[str]					)   ->List[Any]:
            if not self.current:
                   raise StopIteration
            else:
                   snake_case__							:	Union[str, Any]   	=	self.current.get_data()
                   snake_case__							:	Optional[int]   	=	self.current.get_next()
                   return value




class 					snake_case__						:






     """simple docstring"""


     def __init__(       self  :  List[Any]					)   ->Tuple:
            snake_case__							:	List[str]   	=	None  # First node in list
            snake_case__							:	List[str]   	=	None  # Last node in list






     def __str__(       self  :  Optional[Any]					)   ->int:
            snake_case__							:	int   	=	self.head
            snake_case__							:	Union[str, Any]   	=	[]
            while current is not None:
                   nodes.append(current.get_data()					)
                   snake_case__							:	Any   	=	current.get_next()
            return " ".join(str(_snake_case					) for node in nodes					)






     def __contains__(       self  :  List[Any], _snake_case  :  int					)   ->int:
            snake_case__							:	Union[str, Any]   	=	self.head
            while current:
                   if current.get_data() == value:
                          return True
                   snake_case__							:	Optional[Any]   	=	current.get_next()
            return False






     def __iter__(       self  :  str					)   ->Dict:
            return LinkedListIterator(self.head					)






     def    lowercase_   (       self  :  Dict					)   ->List[Any]:
            if self.head:
                   return self.head.get_data()
            return None






     def    lowercase_   (       self  :  List[Any]					)   ->Optional[Any]:
            if self.tail:
                   return self.tail.get_data()
            return None






     def    lowercase_   (       self  :  List[Any], _snake_case  :  Node					)   ->None:
            if self.head is None:
                   snake_case__							:	Union[str, Any]   	=	node
                   snake_case__							:	Union[str, Any]   	=	node
            else:
                   self.insert_before_node(self.head, _snake_case					)






     def    lowercase_   (       self  :  List[Any], _snake_case  :  Node					)   ->None:
            if self.head is None:
                   self.set_head(_snake_case					)
            else:
                   self.insert_after_node(self.tail, _snake_case					)






     def    lowercase_   (       self  :  List[Any], _snake_case  :  int					)   ->None:
            snake_case__							:	Any   	=	Node(_snake_case					)
            if self.head is None:
                   self.set_head(_snake_case					)
            else:
                   self.set_tail(_snake_case					)






     def    lowercase_   (       self  :  List[Any], _snake_case  :  Node, _snake_case  :  Node					)   ->None:
            snake_case__							:	List[str]   	=	node
            snake_case__							:	str   	=	node.previous

            if node.get_previous() is None:
                   snake_case__							:	int   	=	node_to_insert
            else:
                   snake_case__							:	Union[str, Any]   	=	node_to_insert

            snake_case__							:	int   	=	node_to_insert






     def    lowercase_   (       self  :  str, _snake_case  :  Node, _snake_case  :  Node					)   ->None:
            snake_case__							:	Tuple   	=	node
            snake_case__							:	Any   	=	node.next

            if node.get_next() is None:
                   snake_case__							:	Optional[Any]   	=	node_to_insert
            else:
                   snake_case__							:	Optional[int]   	=	node_to_insert

            snake_case__							:	List[Any]   	=	node_to_insert






     def    lowercase_   (       self  :  Dict, _snake_case  :  int, _snake_case  :  int					)   ->None:
            snake_case__							:	Optional[int]   	=	1
            snake_case__							:	List[Any]   	=	Node(_snake_case					)
            snake_case__							:	Tuple   	=	self.head
            while node:
                   if current_position == position:
                          self.insert_before_node(_snake_case, _snake_case					)
                          return
                   current_position += 1
                   snake_case__							:	Union[str, Any]   	=	node.next
            self.insert_after_node(self.tail, _snake_case					)






     def    lowercase_   (       self  :  str, _snake_case  :  int					)   ->Node:
            snake_case__							:	Optional[Any]   	=	self.head
            while node:
                   if node.get_data() == item:
                          return node
                   snake_case__							:	Optional[Any]   	=	node.get_next()
            raise Exception('Node not found'					)






     def    lowercase_   (       self  :  Optional[Any], _snake_case  :  Tuple					)   ->Optional[int]:
            if (node := self.get_node(_snake_case					)) is not None:
                   if node == self.head:
                          snake_case__							:	Tuple   	=	self.head.get_next()

                   if node == self.tail:
                          snake_case__							:	Union[str, Any]   	=	self.tail.get_previous()

                   self.remove_node_pointers(_snake_case					)






     @staticmethod
     def    lowercase_   (       _snake_case  :  Node					)   ->None:
            if node.get_next():
                   snake_case__							:	Dict   	=	node.previous

            if node.get_previous():
                   snake_case__							:	Optional[int]   	=	node.next

            snake_case__							:	Tuple   	=	None
            snake_case__							:	List[Any]   	=	None






     def    lowercase_   (       self  :  List[str]					)   ->str:
            return self.head is None


def        lowercase_							():
       pass


if __name__ == "__main__":
 import doctest

 doctest.testmod()











from ...configuration_utils import PretrainedConfig
from ...utils import logging


a_   :Optional[int]        =      logging.get_logger(__name__)

a_   :Dict        =      {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"}




class 					snake_case__						(       lowerCAmelCase_     ):






     """simple docstring"""


     _SCREAMING_SNAKE_CASE						=	"""openai-gpt"""
     _SCREAMING_SNAKE_CASE						=	{
         """max_position_embeddings""": """n_positions""",
         """hidden_size""": """n_embd""",
         """num_attention_heads""": """n_head""",
         """num_hidden_layers""": """n_layer""",
     }






     def __init__(       self  :  Optional[int], _snake_case  :  Dict=4_0_4_7_8, _snake_case  :  str=5_1_2, _snake_case  :  int=7_6_8, _snake_case  :  Tuple=1_2, _snake_case  :  Any=1_2, _snake_case  :  str="gelu", _snake_case  :  List[str]=0.1, _snake_case  :  Any=0.1, _snake_case  :  Dict=0.1, _snake_case  :  int=1e-5, _snake_case  :  Optional[Any]=0.0_2, _snake_case  :  List[Any]="cls_index", _snake_case  :  Any=True, _snake_case  :  Any=None, _snake_case  :  int=True, _snake_case  :  Optional[Any]=0.1, **_snake_case  :  List[Any], )   ->Optional[int]:
            snake_case__							:	int   	=	vocab_size
            snake_case__							:	Dict   	=	n_positions
            snake_case__							:	str   	=	n_embd
            snake_case__							:	str   	=	n_layer
            snake_case__							:	List[Any]   	=	n_head
            snake_case__							:	List[Any]   	=	afn
            snake_case__							:	Optional[Any]   	=	resid_pdrop
            snake_case__							:	List[str]   	=	embd_pdrop
            snake_case__							:	List[Any]   	=	attn_pdrop
            snake_case__							:	Optional[int]   	=	layer_norm_epsilon
            snake_case__							:	str   	=	initializer_range
            snake_case__							:	List[str]   	=	summary_type
            snake_case__							:	Optional[int]   	=	summary_use_proj
            snake_case__							:	List[str]   	=	summary_activation
            snake_case__							:	Optional[Any]   	=	summary_first_dropout
            snake_case__							:	int   	=	summary_proj_to_labels
            super().__init__(**_snake_case					)






