_datasource.pyi 995 B

123456789101112131415161718192021222324252627282930
  1. from _typeshed import OpenBinaryMode, OpenTextMode
  2. from pathlib import Path
  3. from typing import IO, Any, TypeAlias
  4. _Mode: TypeAlias = OpenBinaryMode | OpenTextMode
  5. ###
  6. # exported in numpy.lib.nppyio
  7. class DataSource:
  8. def __init__(self, /, destpath: Path | str | None = ".") -> None: ...
  9. def __del__(self, /) -> None: ...
  10. def abspath(self, /, path: str) -> str: ...
  11. def exists(self, /, path: str) -> bool: ...
  12. # Whether the file-object is opened in string or bytes mode (by default)
  13. # depends on the file-extension of `path`
  14. def open(self, /, path: str, mode: _Mode = "r", encoding: str | None = None, newline: str | None = None) -> IO[Any]: ...
  15. class Repository(DataSource):
  16. def __init__(self, /, baseurl: str, destpath: str | None = ".") -> None: ...
  17. def listdir(self, /) -> list[str]: ...
  18. def open(
  19. path: str,
  20. mode: _Mode = "r",
  21. destpath: str | None = ".",
  22. encoding: str | None = None,
  23. newline: str | None = None,
  24. ) -> IO[Any]: ...