-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path_internal.pyi
62 lines (51 loc) · 2.03 KB
/
_internal.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from typing import Dict, Iterator, Optional
# For some reason mypy doesn't think this exists
from typing_extensions import Buffer # type: ignore
class FileStatus:
path: str
length: int
isdir: bool
permission: int
owner: str
group: str
modification_time: int
access_time: int
class WriteOptions:
block_size: Optional[int]
replication: Optional[int]
permission: int
overwrite: bool
create_parent: bool
class RawFileReader:
def file_length(self) -> int:
"""Returns the size of the file"""
def seek(self, pos: int) -> None:
"""Sets the cursor to the given position"""
def tell(self) -> int:
"""Returns the current cursor position in the file"""
def read(self, len: int) -> bytes:
"""Reads `len` bytes from the file, advancing the position in the file"""
def read_range(self, offset: int, len: int) -> bytes:
"""Read `len` bytes from the file starting at `offset`. Doesn't affect the position in the file"""
class RawFileWriter:
def write(self, buf: Buffer) -> int:
"""Writes `buf` to the file"""
def close(self) -> None:
"""Closes the file and saves the final metadata to the NameNode"""
class RawClient:
def __init__(self, url: str, config: Optional[Dict[str, str]]) -> None: ...
def get_file_info(self, path: str) -> FileStatus: ...
def list_status(self, path: str, recursive: bool) -> Iterator[FileStatus]: ...
def read(self, path: str) -> RawFileReader: ...
def create(self, path: str, write_options: WriteOptions) -> RawFileWriter: ...
def append(self, path: str) -> RawFileWriter: ...
def mkdirs(self, path: str, permission: int, create_parent: bool) -> None: ...
def rename(self, src: str, dst: str, overwrite: bool) -> None: ...
def delete(self, path: str, recursive: bool) -> bool: ...
def set_times(self, path: str, mtime: int, atime: int) -> None: ...
def set_owner(
self,
path: str,
owner: Optional[str],
group: Optional[str],
) -> None: ...