
"""simple docstring"""



from collections.abc import Callable

import numpy as np


def  _UpperCamelCase	(						_A					,      _A					,      _A					,      _A					,      _A      )    ->  Dict:





    """simple docstring"""

    _UpperCAmelCase          =   int(np.ceil((x_end - xa) / step_size      )      )
    _UpperCAmelCase          =   np.zeros((n + 1,)      )
    _UpperCAmelCase          =   ya
    _UpperCAmelCase          =   xa

    for k in range(__a      ):
        _UpperCAmelCase          =   y[k] + step_size * ode_func(__a					,      y[k]      )
        _UpperCAmelCase          =   y[k] + (
            (step_size / 2) * (ode_func(__a					,      y[k]      ) + ode_func(x + step_size					,      __a      ))
        )
        x += step_size

    return y


if __name__ == "__main__":
 import doctest

 doctest.testmod()

"""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 		a_						( _UpperCAmelCase	):
    a      :				List[Any]     =				''
    a      :				Union[str, Any]     =				'hf-legacy'  # "hf://"" is reserved for hffs







    def __init__(			self			:       Tuple     ,					__UpperCamelCase			:       Optional[DatasetInfo] = None     ,					__UpperCamelCase			:       Optional[str] = None     ,					**__UpperCamelCase			:       Any     ,					)		->Any:






        '''simple docstring'''






        super().__init__(self     ,					**__UpperCamelCase     )
        _UpperCAmelCase          =   repo_info
        _UpperCAmelCase          =   token
        _UpperCAmelCase          =   None







    def      _snake_case					(			self			:       List[str]     )		->List[str]:






        '''simple docstring'''






        if self.dir_cache is None:
            _UpperCAmelCase          =   {}
            for hf_file in self.repo_info.siblings:
                # TODO(QL): add sizes
                _UpperCAmelCase          =   {
                    """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      _snake_case					(			self			:       Tuple     ,					__UpperCamelCase			:       str     ,					__UpperCamelCase			:       str = "rb"     ,					**__UpperCamelCase			:       Any     ,					)		->List[str]:






        '''simple docstring'''






        if not isinstance(self.repo_info     ,					__UpperCamelCase     ):
            raise NotImplementedError(f"""Open is only implemented for dataset repositories, but got {self.repo_info}"""     )
        _UpperCAmelCase          =   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      _snake_case					(			self			:       int     ,					__UpperCamelCase			:       int     ,					**__UpperCamelCase			:       Dict     )		->Tuple:






        '''simple docstring'''






        self._get_dirs()
        _UpperCAmelCase          =   self._strip_protocol(__UpperCamelCase     )
        if path in self.dir_cache:
            return self.dir_cache[path]
        else:
            raise FileNotFoundError(__UpperCamelCase     )







    def      _snake_case					(			self			:       List[str]     ,					__UpperCamelCase			:       Union[str, Any]     ,					__UpperCamelCase			:       Tuple=False     ,					**__UpperCamelCase			:       List[str]     )		->Optional[Any]:






        '''simple docstring'''






        self._get_dirs()
        _UpperCAmelCase          =   PurePosixPath(path.strip("""/"""     )     )
        _UpperCAmelCase          =   {}
        for p, f in self.dir_cache.items():
            _UpperCAmelCase          =   PurePosixPath(p.strip("""/"""     )     )
            _UpperCAmelCase          =   p.parent
            if root == path:
                _UpperCAmelCase          =   f
        _UpperCAmelCase          =   list(paths.values()     )
        if detail:
            return out
        else:
            return sorted(f["""name"""] for f in out     )