



class 		UpperCAmelCase__      :




			'''simple docstring'''






			def __init__(       self							:			Dict	,	a_							:			List[str]			):
					'''simple docstring'''





					__UpperCAmelCase   :					str													=     data
					__UpperCAmelCase   :					List[str]													=     None
					__UpperCAmelCase   :					Optional[int]													=     None




			def __str__(       self							:			List[Any]			):
					'''simple docstring'''





					return F'{self.data}'

class 		UpperCAmelCase__      :




			'''simple docstring'''






			def __init__(       self							:			Any			):
					'''simple docstring'''





					__UpperCAmelCase   :					Union[str, Any]													=     None
					__UpperCAmelCase   :					List[str]													=     None




			def __iter__(       self							:			Optional[int]			):
					'''simple docstring'''





					__UpperCAmelCase   :					int													=     self.head
					while node:
							yield node.data
							__UpperCAmelCase   :					Any													=     node.next




			def __str__(       self							:			Union[str, Any]			):
					'''simple docstring'''





					return "->".join([str(a_			) for item in self]			)




			def __len__(       self							:			Union[str, Any]			):
					'''simple docstring'''





					return sum(1 for _ in self			)




			def 			snake_case__					(       self							:			Union[str, Any]	,	a_							:			Optional[Any]			):
					'''simple docstring'''





					self.insert_at_nth(0	,	a_			)




			def 			snake_case__					(       self							:			List[Any]	,	a_							:			Any			):
					'''simple docstring'''





					self.insert_at_nth(len(self			)	,	a_			)




			def 			snake_case__					(       self							:			Dict	,	a_							:			int	,	a_							:			Dict			):
					'''simple docstring'''





					__UpperCAmelCase   :					str													=     len(self			)

					if not 0 <= index <= length:
							raise IndexError('''list index out of range'''			)
					__UpperCAmelCase   :					List[Any]													=     Node(a_			)
					if self.head is None:
							__UpperCAmelCase   :					Union[str, Any]													=     new_node
					elif index == 0:
							__UpperCAmelCase   :					Dict													=     new_node
							__UpperCAmelCase   :					int													=     self.head
							__UpperCAmelCase   :					Optional[int]													=     new_node
					elif index == length:
							__UpperCAmelCase   :					Dict													=     new_node
							__UpperCAmelCase   :					Union[str, Any]													=     self.tail
							__UpperCAmelCase   :					Tuple													=     new_node
					else:
							__UpperCAmelCase   :					Dict													=     self.head
							for _ in range(0	,	a_			):
									__UpperCAmelCase   :					Union[str, Any]													=     temp.next
							__UpperCAmelCase   :					Optional[Any]													=     new_node
							__UpperCAmelCase   :					Optional[Any]													=     temp.previous
							__UpperCAmelCase   :					List[str]													=     temp
							__UpperCAmelCase   :					str													=     new_node




			def 			snake_case__					(       self							:			Tuple			):
					'''simple docstring'''





					return self.delete_at_nth(0			)




			def 			snake_case__					(       self							:			int			):
					'''simple docstring'''





					return self.delete_at_nth(len(self			) - 1			)




			def 			snake_case__					(       self							:			Any	,	a_							:			int			):
					'''simple docstring'''





					__UpperCAmelCase   :					int													=     len(self			)

					if not 0 <= index <= length - 1:
							raise IndexError('''list index out of range'''			)
					__UpperCAmelCase   :					Dict													=     self.head  # default first node
					if length == 1:
							__UpperCAmelCase   :					Optional[int]													=     None
					elif index == 0:
							__UpperCAmelCase   :					Tuple													=     self.head.next
							__UpperCAmelCase   :					Optional[Any]													=     None
					elif index == length - 1:
							__UpperCAmelCase   :					str													=     self.tail
							__UpperCAmelCase   :					Union[str, Any]													=     self.tail.previous
							__UpperCAmelCase   :					Optional[int]													=     None
					else:
							__UpperCAmelCase   :					Optional[int]													=     self.head
							for _ in range(0	,	a_			):
									__UpperCAmelCase   :					Union[str, Any]													=     temp.next
							__UpperCAmelCase   :					Optional[Any]													=     temp
							__UpperCAmelCase   :					str													=     temp.previous
							__UpperCAmelCase   :					int													=     temp.next
					return delete_node.data




			def 			snake_case__					(       self							:			List[str]	,	a_							:			str			):
					'''simple docstring'''





					__UpperCAmelCase   :					Tuple													=     self.head

					while current.data != data:  # Find the position to delete
							if current.next:
									__UpperCAmelCase   :					Dict													=     current.next
							else:  # We have reached the end an no value matches
									raise ValueError('''No data matching given value'''			)

					if current == self.head:
							self.delete_head()

					elif current == self.tail:
							self.delete_tail()

					else:  # Before: 1 <--> 2(current) <--> 3
							__UpperCAmelCase   :					Tuple													=     current.next  # 1 --> 3
							__UpperCAmelCase   :					Optional[Any]													=     current.previous  # 1 <--> 3
					return data




			def 			snake_case__					(       self							:			Any			):
					'''simple docstring'''





					return len(self			) == 0

def 	a						(				):







		'''simple docstring'''





		__UpperCAmelCase   :					List[str]													=     DoublyLinkedList()
		assert linked_list.is_empty() is True
		assert str(_UpperCAmelCase						) == ""

		try:
				linked_list.delete_head()
				raise AssertionError  # This should not happen.
		except IndexError:
				assert True  # This should happen.

		try:
				linked_list.delete_tail()
				raise AssertionError  # This should not happen.
		except IndexError:
				assert True  # This should happen.

		for i in range(10						):
				assert len(_UpperCAmelCase						) == i
				linked_list.insert_at_nth(_UpperCAmelCase			,       i + 1						)
		assert str(_UpperCAmelCase						) == "->".join(str(_UpperCAmelCase						) for i in range(1			,       11						)						)

		linked_list.insert_at_head(0						)
		linked_list.insert_at_tail(11						)
		assert str(_UpperCAmelCase						) == "->".join(str(_UpperCAmelCase						) for i in range(0			,       12						)						)

		assert linked_list.delete_head() == 0
		assert linked_list.delete_at_nth(9						) == 10
		assert linked_list.delete_tail() == 11
		assert len(_UpperCAmelCase						) == 9
		assert str(_UpperCAmelCase						) == "->".join(str(_UpperCAmelCase						) for i in range(1			,       10						)						)


if __name__ == "__main__":
				from doctest import testmod

				testmod()










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


__A             =logging.get_logger(__name__)

__A             ={
    "tau/splinter-base": "https://huggingface.co/tau/splinter-base/resolve/main/config.json",
    "tau/splinter-base-qass": "https://huggingface.co/tau/splinter-base-qass/resolve/main/config.json",
    "tau/splinter-large": "https://huggingface.co/tau/splinter-large/resolve/main/config.json",
    "tau/splinter-large-qass": "https://huggingface.co/tau/splinter-large-qass/resolve/main/config.json",
    # See all Splinter models at https://huggingface.co/models?filter=splinter
}

class 		UpperCAmelCase__      (      __UpperCamelCase       ):




			'''simple docstring'''






			UpperCamelCase      						=	"""splinter"""




			def __init__(       self							:			Any	,	a_							:			Optional[int]=3_05_22	,	a_							:			Union[str, Any]=7_68	,	a_							:			int=12	,	a_							:			int=12	,	a_							:			List[Any]=30_72	,	a_							:			Union[str, Any]="gelu"	,	a_							:			Any=0.1	,	a_							:			Union[str, Any]=0.1	,	a_							:			Any=5_12	,	a_							:			str=2	,	a_							:			Dict=0.0_2	,	a_							:			int=1e-12	,	a_							:			str=True	,	a_							:			Tuple=0	,	a_							:			List[Any]=1_04	,	**a_							:			str	,	):
					'''simple docstring'''





					super().__init__(pad_token_id=a_	,	**a_			)

					__UpperCAmelCase   :					Union[str, Any]													=     vocab_size
					__UpperCAmelCase   :					List[Any]													=     max_position_embeddings
					__UpperCAmelCase   :					str													=     hidden_size
					__UpperCAmelCase   :					Union[str, Any]													=     num_hidden_layers
					__UpperCAmelCase   :					Any													=     num_attention_heads
					__UpperCAmelCase   :					Any													=     intermediate_size
					__UpperCAmelCase   :					Tuple													=     hidden_act
					__UpperCAmelCase   :					str													=     hidden_dropout_prob
					__UpperCAmelCase   :					Any													=     attention_probs_dropout_prob
					__UpperCAmelCase   :					Optional[int]													=     initializer_range
					__UpperCAmelCase   :					Any													=     type_vocab_size
					__UpperCAmelCase   :					int													=     layer_norm_eps
					__UpperCAmelCase   :					List[Any]													=     use_cache
					__UpperCAmelCase   :					Optional[int]													=     question_token_id





