-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path_internal.pyi
More file actions
286 lines (241 loc) · 10.6 KB
/
_internal.pyi
File metadata and controls
286 lines (241 loc) · 10.6 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import pyarrow.fs as fs
class Path:
def __init__(self, raw: str | list[str]) -> None: ...
def child(self, part: str) -> Path: ...
class ObjectMeta:
"""The metadata that describes an object."""
@property
def size(self) -> int:
"""The size in bytes of the object"""
@property
def location(self) -> Path:
"""The full path to the object"""
@property
def last_modified(self) -> int:
"""The last modified time"""
class ListResult:
"""Result of a list call that includes objects and prefixes (directories)"""
@property
def common_prefixes(self) -> list[Path]:
"""Prefixes that are common (like directories)"""
@property
def objects(self) -> list[ObjectMeta]:
"""Object metadata for the listing"""
class PutResult:
"""TODO..."""
# @property
# def common_prefixes(self) -> list[Path]:
# """Prefixes that are common (like directories)"""
# @property
# def objects(self) -> list[ObjectMeta]:
# """Object metadata for the listing"""
pass
class MultipartUpload:
"""TODO..."""
# @property
# def common_prefixes(self) -> list[Path]:
# """Prefixes that are common (like directories)"""
# @property
# def objects(self) -> list[ObjectMeta]:
# """Object metadata for the listing"""
pass
class ClientOptions:
"""HTTP client configuration for remote object stores"""
@property
def user_agent(self) -> str | None:
"""Sets the User-Agent header to be used by this client
Default is based on the version of this crate
"""
@property
def default_content_type(self) -> str | None:
"""Set the default CONTENT_TYPE for uploads"""
@property
def proxy_url(self) -> str | None:
"""Set an HTTP proxy to use for requests"""
@property
def allow_http(self) -> bool:
"""Sets what protocol is allowed.
If `allow_http` is :
* false (default): Only HTTPS ise allowed
* true: HTTP and HTTPS are allowed
"""
@property
def allow_insecure(self) -> bool:
"""Allows connections to invalid SSL certificates
* false (default): Only valid HTTPS certificates are allowed
* true: All HTTPS certificates are allowed
# Warning
You should think very carefully before using this method. If
invalid certificates are trusted, *any* certificate for *any* site
will be trusted for use. This includes expired certificates. This
introduces significant vulnerabilities, and should only be used
as a last resort or for testing.
"""
@property
def timeout(self) -> int:
"""Set a request timeout (seconds)
The timeout is applied from when the request starts connecting until the
response body has finished
"""
@property
def connect_timeout(self) -> int:
"""Set a timeout (seconds) for only the connect phase of a Client"""
@property
def pool_idle_timeout(self) -> int:
"""Set the pool max idle timeout (seconds)
This is the length of time an idle connection will be kept alive
Default is 90 seconds
"""
@property
def pool_max_idle_per_host(self) -> int:
"""Set the maximum number of idle connections per host
Default is no limit"""
@property
def http2_keep_alive_interval(self) -> int:
"""Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive.
Default is disabled
"""
@property
def http2_keep_alive_timeout(self) -> int:
"""Sets a timeout for receiving an acknowledgement of the keep-alive ping.
If the ping is not acknowledged within the timeout, the connection will be closed.
Does nothing if http2_keep_alive_interval is disabled.
Default is disabled
"""
@property
def http2_keep_alive_while_idle(self) -> bool:
"""Enable HTTP2 keep alive pings for idle connections
If disabled, keep-alive pings are only sent while there are open request/response
streams. If enabled, pings are also sent when no streams are active
Default is disabled
"""
@property
def http1_only(self) -> bool:
"""Only use http1 connections"""
@property
def http2_only(self) -> bool:
"""Only use http2 connections"""
class ObjectStore:
"""A uniform API for interacting with object storage services and local files."""
def __init__(
self, root: str, options: dict[str, str] | None = None, client_options: ClientOptions | None = None
) -> None: ...
def get(self, location: Path) -> bytes:
"""Return the bytes that are stored at the specified location."""
def get_range(self, location: Path, start: int, length: int) -> bytes:
"""Return the bytes that are stored at the specified location in the given byte range."""
def put(self, location: Path, bytes: bytes) -> PutResult:
"""Save the provided bytes to the specified location."""
def put_opts(self, location: Path, bytes: bytes) -> PutResult:
"""Save the provided bytes to the specified location with the given options"""
def put_multipart(self, location: Path) -> MultipartUpload:
"""Perform a multipart upload"""
def list(self, prefix: Path | None) -> list[ObjectMeta]:
"""List all the objects with the given prefix.
Prefixes are evaluated on a path segment basis, i.e. `foo/bar/` is a prefix
of `foo/bar/x` but not of `foo/bar_baz/x`.
"""
def head(self, location: Path) -> ObjectMeta:
"""Return the metadata for the specified location"""
def list_with_delimiter(self, prefix: Path | None) -> ListResult:
"""List objects with the given prefix and an implementation specific
delimiter. Returns common prefixes (directories) in addition to object
metadata.
Prefixes are evaluated on a path segment basis, i.e. `foo/bar/` is a prefix
of `foo/bar/x` but not of `foo/bar_baz/x`.
"""
def delete(self, location: Path) -> None:
"""Delete the object at the specified location."""
def copy(self, src: Path, dst: Path) -> None:
"""Copy an object from one path to another in the same object store.
If there exists an object at the destination, it will be overwritten.
"""
def copy_if_not_exists(self, src: Path, dst: Path) -> None:
"""Copy an object from one path to another, only if destination is empty.
Will return an error if the destination already has an object.
"""
def rename(self, src: Path, dst: Path) -> None:
"""Move an object from one path to another in the same object store.
By default, this is implemented as a copy and then delete source. It may not
check when deleting source that it was the same object that was originally copied.
If there exists an object at the destination, it will be overwritten.
"""
def rename_if_not_exists(self, src: Path, dst: Path) -> None:
"""Move an object from one path to another in the same object store.
Will return an error if the destination already has an object.
"""
class ObjectInputFile:
@property
def closed(self) -> bool: ...
@property
def mode(self) -> str: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def size(self) -> int: ...
def seek(self, position: int, whence: int) -> int: ...
def read(self, nbytes: int) -> bytes: ...
class ObjectOutputStream:
@property
def closed(self) -> bool: ...
@property
def mode(self) -> str: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...
def tell(self) -> int: ...
def size(self) -> int: ...
def seek(self, position: int, whence: int) -> int: ...
def read(self, nbytes: int) -> bytes: ...
def write(self, data: bytes) -> int: ...
class ArrowFileSystemHandler:
"""Implementation of pyarrow.fs.FileSystemHandler for use with pyarrow.fs.PyFileSystem"""
def __init__(
self, root: str, options: dict[str, str] | None = None, client_options: ClientOptions | None = None
) -> None: ...
def copy_file(self, src: str, dst: str) -> None:
"""Copy a file.
If the destination exists and is a directory, an error is returned. Otherwise, it is replaced.
"""
def create_dir(self, path: str, *, recursive: bool = True) -> None:
"""Create a directory and subdirectories.
This function succeeds if the directory already exists.
"""
def delete_dir(self, path: str) -> None:
"""Delete a directory and its contents, recursively."""
def delete_file(self, path: str) -> None:
"""Delete a file."""
def equals(self, other) -> bool: ...
def delete_dir_contents(self, path: str, *, accept_root_dir: bool = False, missing_dir_ok: bool = False) -> None:
"""Delete a directory's contents, recursively.
Like delete_dir, but doesn't delete the directory itself.
"""
def get_file_info(self, paths: list[str]) -> list[fs.FileInfo]:
"""Get info for the given files.
A non-existing or unreachable file returns a FileStat object and has a FileType of value NotFound.
An exception indicates a truly exceptional condition (low-level I/O error, etc.).
"""
def get_file_info_selector(
self, base_dir: str, allow_not_found: bool = False, recursive: bool = False
) -> list[fs.FileInfo]:
"""Get info for the given files.
A non-existing or unreachable file returns a FileStat object and has a FileType of value NotFound.
An exception indicates a truly exceptional condition (low-level I/O error, etc.).
"""
def move_file(self, src: str, dest: str) -> None:
"""Move / rename a file or directory.
If the destination exists: - if it is a non-empty directory, an error is returned - otherwise,
if it has the same type as the source, it is replaced - otherwise, behavior is
unspecified (implementation-dependent).
"""
def normalize_path(self, path: str) -> str:
"""Normalize filesystem path."""
def open_input_file(self, path: str) -> ObjectInputFile:
"""Open an input file for random access reading."""
def open_output_stream(self, path: str, metadata: dict[str, str] | None = None) -> ObjectOutputStream:
"""Open an output stream for sequential writing."""