





"""simple docstring"""






from pathlib import PurePosixPath
from typing import Optional

import fsspec
from fsspec import AbstractFileSystem
from huggingface_hub.hf_api import DatasetInfo

from ..utils.file_utils import get_authentication_headers_for_url
from ..utils.hub import hf_hub_url




class 			__lowercase     (     _UpperCamelCase							):







					'''simple docstring'''




					__lowerCAmelCase					=					''''''
					__lowerCAmelCase					=					'''hf-legacy'''  # "hf://"" is reserved for hffs







					def __init__(  self		,     _UpperCAmelCase = None		,     _UpperCAmelCase = None		,     **_UpperCAmelCase		,     ):
									super().__init__(self		,     **_UpperCAmelCase       )
									__a	:  Union[str, Any]         =					repo_info
									__a	:  Optional[int]         =					token
									__a	:  Any         =					None







					def 	_lowerCamelCase						(  self       ):
									if self.dir_cache is None:
													__a	:  int         =					{}
													for hf_file in self.repo_info.siblings:
																	# TODO(QL): add sizes
																	__a	:  Optional[int]         =					{
																	    '''name''': hf_file.rfilename,
																	    '''size''': None,
																	    '''type''': '''file''',
																	}
																	self.dir_cache.update(
																	    {
																	        str(_UpperCAmelCase       ): {'''name''': str(_UpperCAmelCase       ), '''size''': None, '''type''': '''directory'''}
																	        for d in list(PurePosixPath(hf_file.rfilename       ).parents       )[:-1]
																	    }       )







					def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase = "rb"		,     **_UpperCAmelCase		,     ):
									if not isinstance(self.repo_info		,     _UpperCAmelCase       ):
													raise NotImplementedError(f"""Open is only implemented for dataset repositories, but got {self.repo_info}"""       )
									__a	:  Dict         =					hf_hub_url(self.repo_info.id		,     _UpperCAmelCase		,     revision=self.repo_info.sha       )
									return fsspec.open(
									    _UpperCAmelCase		,     mode=_UpperCAmelCase		,     headers=get_authentication_headers_for_url(_UpperCAmelCase		,     use_auth_token=self.token       )		,     client_kwargs={'''trust_env''': True}		,     ).open()







					def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     **_UpperCAmelCase       ):
									self._get_dirs()
									__a	:  Optional[Any]         =					self._strip_protocol(_UpperCAmelCase       )
									if path in self.dir_cache:
													return self.dir_cache[path]
									else:
													raise FileNotFoundError(_UpperCAmelCase       )







					def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase=False		,     **_UpperCAmelCase       ):
									self._get_dirs()
									__a	:  Dict         =					PurePosixPath(path.strip('''/'''       )       )
									__a	:  Tuple         =					{}
									for p, f in self.dir_cache.items():
													__a	:  Optional[int]         =					PurePosixPath(p.strip('''/'''       )       )
													__a	:  Tuple         =					p.parent
													if root == path:
																	__a	:  Any         =					f
									__a	:  str         =					list(paths.values()       )
									if detail:
													return out
									else:
													return sorted(f['''name'''] for f in out       )






"""simple docstring"""






def       __A (     a_  :float)						->						float:

				if edge <= 0 or not isinstance(a_				,    a_):
								raise ValueError('''Length must be a positive.''')
				return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2)

def       __A (     a_  :float)						->						float:

				if edge <= 0 or not isinstance(a_				,    a_):
								raise ValueError('''Length must be a positive.''')
				return ((15 + (7 * (5 ** (1 / 2)))) / 4) * (edge**3)


if __name__ == "__main__":
		import doctest

		doctest.testmod()