






"""simple docstring"""







import posixpath
from pathlib import Path
from unittest.mock import patch

import pytest
from fsspec.implementations.local import AbstractFileSystem, LocalFileSystem, stringify_path
from fsspec.registry import _registry as _fsspec_registry







class 							_SCREAMING_SNAKE_CASE    (	__snake_case				):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE     ='mock'




							def __init__( self:  Union[str, Any]					,		*__A:  Optional[Any]					,		__A:  Optional[Any]					,		**__A:  Tuple     ):

												'''simple docstring'''

												super().__init__()
												a__ 							=	LocalFileSystem(*__A					,		**__A     )
												a__ 							=	Path(__A     ).resolve().as_posix() + '''/'''




							def 			lowercase		( self:  Any					,		__A:  Any					,		*__A:  List[str]					,		**__A:  List[str]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.mkdir(__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  Dict					,		__A:  Tuple					,		*__A:  Optional[Any]					,		**__A:  Optional[int]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.makedirs(__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  Any					,		__A:  Optional[int]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.rmdir(__A     )




							def 			lowercase		( self:  Any					,		__A:  Optional[Any]					,		__A:  Optional[int]=True					,		*__A:  Dict					,		**__A:  Any     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												a__ 							=	self._fs.ls(__A					,		detail=__A					,		*__A					,		**__A     )
												if detail:
																	return [{**info, "name": info["name"][len(self.local_root_dir     ) :]} for info in out]
												else:
																	return [name[len(self.local_root_dir     ) :] for name in out]




							def 			lowercase		( self:  str					,		__A:  Optional[int]					,		*__A:  Optional[Any]					,		**__A:  int     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												a__ 							=	dict(self._fs.info(__A					,		*__A					,		**__A     )     )
												a__ 							=	out['''name'''][len(self.local_root_dir     ) :]
												return out




							def 			lowercase		( self:  Tuple					,		__A:  int					,		__A:  Dict					,		*__A:  Tuple					,		**__A:  Any     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.cp_file(__A					,		__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  List[Any]					,		__A:  Optional[int]					,		*__A:  Optional[Any]					,		**__A:  str     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.rm_file(__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  List[str]					,		__A:  List[str]					,		*__A:  Any					,		**__A:  Optional[int]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.rm(__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  Union[str, Any]					,		__A:  Dict					,		*__A:  Union[str, Any]					,		**__A:  int     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs._open(__A					,		*__A					,		**__A     )




							def 			lowercase		( self:  str					,		__A:  Union[str, Any]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.created(__A     )




							def 			lowercase		( self:  Dict					,		__A:  List[Any]     ):

												'''simple docstring'''

												a__ 							=	posixpath.join(self.local_root_dir					,		self._strip_protocol(__A     )     )
												return self._fs.modified(__A     )





							@classmethod
							def 			lowercase		( cls:  str					,		__A:  List[Any]     ):

												'''simple docstring'''

												a__ 							=	stringify_path(__A     )
												if path.startswith('''mock://'''     ):
																	a__ 							=	path[7:]
												return path







class 							_SCREAMING_SNAKE_CASE    (	__snake_case				):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE     ='tmp'
							_SCREAMING_SNAKE_CASE     =None




							def __init__( self:  Union[str, Any]					,		*__A:  Any					,		**__A:  Optional[Any]     ):

												'''simple docstring'''

												assert self.tmp_dir is not None, "TmpDirFileSystem.tmp_dir is not set"
												super().__init__(*__A					,		**__A					,		local_root_dir=self.tmp_dir					,		auto_mkdir=__A     )





							@classmethod
							def 			lowercase		( cls:  List[Any]					,		__A:  Tuple     ):

												'''simple docstring'''

												a__ 							=	stringify_path(__A     )
												if path.startswith('''tmp://'''     ):
																	a__ 							=	path[6:]
												return path





@pytest.fixture
def 							SCREAMING_SNAKE_CASE							(   ):
					a__ 							=	MockFileSystem
					a__ 							=	TmpDirFileSystem
					yield
					del _fsspec_registry["mock"]
					del _fsspec_registry["tmp"]





@pytest.fixture
def 							SCREAMING_SNAKE_CASE							(   lowerCamelCase_			,  lowerCamelCase_):
					a__ 							=	tmp_path_factory.mktemp('''mockfs''')
					return MockFileSystem(local_root_dir=lowerCamelCase_			,  auto_mkdir=lowerCamelCase_)





@pytest.fixture
def 							SCREAMING_SNAKE_CASE							(   lowerCamelCase_			,  lowerCamelCase_):
					a__ 							=	tmp_path_factory.mktemp('''tmpfs''')
					with patch.object(lowerCamelCase_			,  '''tmp_dir'''			,  lowerCamelCase_):
										yield TmpDirFileSystem()










"""simple docstring"""







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


__a							:						Union[str, Any]   							=			logging.get_logger(__name__)

__a							:						Optional[Any]   							=			{
    '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 							_SCREAMING_SNAKE_CASE    (	__snake_case				):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE     ='splinter'




							def __init__( self:  Dict					,		__A:  List[Any]=30522					,		__A:  str=768					,		__A:  int=12					,		__A:  str=12					,		__A:  Tuple=3072					,		__A:  Dict="gelu"					,		__A:  Optional[int]=0.1					,		__A:  List[str]=0.1					,		__A:  str=512					,		__A:  List[Any]=2					,		__A:  Any=0.0_2					,		__A:  Any=1e-12					,		__A:  Tuple=True					,		__A:  List[Any]=0					,		__A:  List[str]=104					,		**__A:  Union[str, Any]					,		):

												'''simple docstring'''

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

												a__ 							=	vocab_size
												a__ 							=	max_position_embeddings
												a__ 							=	hidden_size
												a__ 							=	num_hidden_layers
												a__ 							=	num_attention_heads
												a__ 							=	intermediate_size
												a__ 							=	hidden_act
												a__ 							=	hidden_dropout_prob
												a__ 							=	attention_probs_dropout_prob
												a__ 							=	initializer_range
												a__ 							=	type_vocab_size
												a__ 							=	layer_norm_eps
												a__ 							=	use_cache
												a__ 							=	question_token_id


