-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path_internal.pyi
119 lines (102 loc) · 3.69 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from typing import Dict, Iterator, List, Literal, 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
replication: Optional[int]
blocksize: Optional[int]
class ContentSummary:
length: int
file_count: int
directory_count: int
quota: int
space_consumed: int
space_quota: int
AclEntryType = Literal["user", "group", "mask", "other"]
AclEntryScope = Literal["access", "default"]
FsAction = Literal["---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"]
class AclEntry:
type: AclEntryType
scope: AclEntryScope
permissions: FsAction
name: Optional[str]
def __init__(
self,
type: AclEntryType,
scope: AclEntryScope,
permissions: FsAction,
name: Optional[str] = None,
): ...
class AclStatus:
owner: str
group: str
sticky: bool
entries: List[AclEntry]
permission: int
class WriteOptions:
block_size: Optional[int]
replication: Optional[int]
permission: int
overwrite: bool
create_parent: bool
def __init__(
self,
block_size: Optional[int] = None,
replication: Optional[int] = None,
permission: Optional[int] = None,
overwrite: Optional[bool] = None,
create_parent: Optional[bool] = None,
): ...
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: Optional[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: ...
def set_permission(self, path: str, permission: int) -> None: ...
def set_replication(self, path: str, replication: int) -> bool: ...
def get_content_summary(self, path: str) -> ContentSummary: ...
def modify_acl_entries(self, path: str, entries: List[AclEntry]) -> None: ...
def remove_acl_entries(self, path: str, entries: List[AclEntry]) -> None: ...
def remove_default_acl(self, path: str) -> None: ...
def remove_acl(self, path: str) -> None: ...
def set_acl(self, path: str, entries: List[AclEntry]) -> None: ...
def get_acl_status(self, path: str) -> AclStatus: ...