

'''simple docstring'''
import os
from typing import Optional

import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE







class 							A__   (	__lowercase  ):
  A__					=    ''''''
  A__					=    (
      None  # protocol passed in prefix to the url. ex: "gzip", for gzip://file.txt::http://foo.bar/file.txt.gz
  )
  A__					=    None  # compression type in fsspec. ex: "gzip"
  A__					=    None  # extension of the filename to strip. ex: "".gz" to get file.txt from file.txt.gz





  def __init__(		self				:     Any							, _a				:     str = ""							, _a				:     Optional[str] = None							, _a				:     Optional[dict] = None							, **_a				:     Any			)     ->   Tuple:





       '''simple docstring'''






       super().__init__(self							, **UpperCAmelCase__			)
       # always open as "rb" since fsspec can then use the TextIOWrapper to make it work for "r" mode
       _SCREAMING_SNAKE_CASE							   =fsspec.open(
           UpperCAmelCase__							, mode='rb'							, protocol=UpperCAmelCase__							, compression=self.compression							, client_kwargs={
               'requote_redirect_url': False,  # see https://github.com/huggingface/datasets/pull/5459
               'trust_env': True,  # Enable reading proxy env variables.
               **(target_options or {}).pop('client_kwargs'							, {}			),  # To avoid issues if it was already passed.
           }							, **(target_options or {})							, )
       _SCREAMING_SNAKE_CASE							   =os.path.basename(self.file.path.split('::'			)[0]			)
       _SCREAMING_SNAKE_CASE							   =(
           self.compressed_name[: self.compressed_name.rindex('.'			)]
           if '.' in self.compressed_name
           else self.compressed_name
       )
       _SCREAMING_SNAKE_CASE							   =None





  @classmethod
  def 						A  (		cls				:     Any							, _a				:     List[str]			)     ->   Dict:





       '''simple docstring'''






       return super()._strip_protocol(UpperCAmelCase__			).lstrip('/'			)





  def 						A  (		self				:     Optional[int]			)     ->   List[str]:





       '''simple docstring'''






       if self.dir_cache is None:
            _SCREAMING_SNAKE_CASE							   ={**self.file.fs.info(self.file.path			), 'name': self.uncompressed_name}
            _SCREAMING_SNAKE_CASE							   ={f['name']: f}





  def 						A  (		self				:     Tuple							, _a				:     str			)     ->   Optional[Any]:





       '''simple docstring'''






       return self.file.open().read()





  def 						A  (		self				:     Optional[Any]							, _a				:     str							, _a				:     str = "rb"							, _a				:     Optional[Any]=None							, _a				:     Any=True							, _a				:     List[Any]=None							, **_a				:     List[str]							, )     ->   Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =self._strip_protocol(UpperCAmelCase__			)
       if mode != "rb":
            raise ValueError(f"Tried to read with mode {mode} on file {self.file.path} opened with mode \'rb\'"			)
       return self.file.open()







class 							A__   (	__lowercase  ):
  A__					=    '''bz2'''
  A__					=    '''bz2'''
  A__					=    '''.bz2'''







class 							A__   (	__lowercase  ):
  A__					=    '''gzip'''
  A__					=    '''gzip'''
  A__					=    '''.gz'''







class 							A__   (	__lowercase  ):
  A__					=    '''lz4'''
  A__					=    '''lz4'''
  A__					=    '''.lz4'''







class 							A__   (	__lowercase  ):
  A__					=    '''xz'''
  A__					=    '''xz'''
  A__					=    '''.xz'''







class 							A__   (	__lowercase  ):
  A__					=    '''zstd'''
  A__					=    '''zstd'''
  A__					=    '''.zst'''





  def __init__(		self				:     List[str]							, _a				:     str							, _a				:     str = "rb"							, _a				:     Optional[str] = None							, _a				:     Optional[dict] = None							, _a				:     int = DEFAULT_BLOCK_SIZE							, **_a				:     Dict							, )     ->   Dict:





       '''simple docstring'''






       super().__init__(
           fo=UpperCAmelCase__							, mode=UpperCAmelCase__							, target_protocol=UpperCAmelCase__							, target_options=UpperCAmelCase__							, block_size=UpperCAmelCase__							, **UpperCAmelCase__							, )
       # We need to wrap the zstd decompressor to avoid this error in fsspec==2021.7.0 and zstandard==0.15.2:
       #
       # File "/Users/user/.virtualenvs/hf-datasets/lib/python3.7/site-packages/fsspec/core.py", line 145, in open
       #     out.close = close
       # AttributeError: 'zstd.ZstdDecompressionReader' object attribute 'close' is read-only
       #
       # see https://github.com/intake/filesystem_spec/issues/725
       _SCREAMING_SNAKE_CASE							   =self.file.__enter__







       class 							A__   :





         def __init__(		self				:     List[Any]							, _a				:     Dict			)     ->   Optional[int]:





              '''simple docstring'''






              _SCREAMING_SNAKE_CASE							   =file_





         def __enter__(		self				:     str			)     ->   Union[str, Any]:





              '''simple docstring'''






              self._file.__enter__()
              return self





         def __exit__(		self				:     Any							, *_a				:     int							, **_a				:     Optional[Any]			)     ->   Dict:





              '''simple docstring'''






              self._file.__exit__(*UpperCAmelCase__							, **UpperCAmelCase__			)





         def __iter__(		self				:     Tuple			)     ->   List[Any]:





              '''simple docstring'''






              return iter(self._file			)





         def 						A  (		self				:     List[Any]			)     ->   Tuple:





              '''simple docstring'''






              return next(self._file			)





         def __getattr__(		self				:     str							, _a				:     int			)     ->   Dict:





              '''simple docstring'''






              return getattr(self._file							, UpperCAmelCase__			)

       def fixed_enter(*_a				:     List[str]							, **_a				:     int			):
            return WrappedFile(_enter(*UpperCAmelCase__							, **UpperCAmelCase__			)			)

       _SCREAMING_SNAKE_CASE							   =fixed_enter



'''simple docstring'''
def 	_lowerCAmelCase (						_UpperCamelCase						:					float							,			_UpperCamelCase						:					float    )				->      float:
     """simple docstring"""




     if mass < 0:
          raise ValueError('The mass of a body cannot be negative'    )
     return 0.5 * mass * abs(_UpperCamelCase    ) * abs(_UpperCamelCase    )


if __name__ == "__main__":
     import doctest

     doctest.testmod(verbose=True)
