megfile 3.1.6__py3-none-any.whl → 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- megfile/cli.py +12 -7
- megfile/config.py +34 -44
- megfile/fs.py +169 -11
- megfile/fs_path.py +183 -259
- megfile/hdfs.py +106 -5
- megfile/hdfs_path.py +34 -90
- megfile/http.py +50 -1
- megfile/http_path.py +27 -65
- megfile/interfaces.py +1 -8
- megfile/lib/base_prefetch_reader.py +62 -78
- megfile/lib/combine_reader.py +5 -0
- megfile/lib/glob.py +3 -6
- megfile/lib/hdfs_prefetch_reader.py +7 -7
- megfile/lib/http_prefetch_reader.py +6 -6
- megfile/lib/s3_buffered_writer.py +67 -64
- megfile/lib/s3_cached_handler.py +1 -2
- megfile/lib/s3_limited_seekable_writer.py +3 -7
- megfile/lib/s3_memory_handler.py +1 -2
- megfile/lib/s3_pipe_handler.py +1 -2
- megfile/lib/s3_prefetch_reader.py +15 -20
- megfile/lib/s3_share_cache_reader.py +8 -5
- megfile/pathlike.py +397 -401
- megfile/s3.py +118 -17
- megfile/s3_path.py +150 -224
- megfile/sftp.py +300 -10
- megfile/sftp_path.py +46 -322
- megfile/smart.py +33 -27
- megfile/smart_path.py +9 -14
- megfile/stdio.py +1 -1
- megfile/stdio_path.py +2 -2
- megfile/utils/__init__.py +11 -4
- megfile/version.py +1 -1
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/METADATA +7 -7
- megfile-4.0.0.dist-info/RECORD +52 -0
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/WHEEL +1 -1
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/top_level.txt +0 -2
- docs/conf.py +0 -65
- megfile-3.1.6.dist-info/RECORD +0 -55
- scripts/convert_results_to_sarif.py +0 -91
- scripts/generate_file.py +0 -344
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/LICENSE +0 -0
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/LICENSE.pyre +0 -0
- {megfile-3.1.6.dist-info → megfile-4.0.0.dist-info}/entry_points.txt +0 -0
megfile/smart_path.py
CHANGED
|
@@ -8,7 +8,7 @@ from megfile.lib.url import get_url_scheme
|
|
|
8
8
|
from megfile.utils import cached_classproperty
|
|
9
9
|
|
|
10
10
|
from .errors import ProtocolExistsError, ProtocolNotFoundError
|
|
11
|
-
from .interfaces import BasePath,
|
|
11
|
+
from .interfaces import BasePath, PathLike
|
|
12
12
|
|
|
13
13
|
aliases_config = "~/.config/megfile/aliases.conf"
|
|
14
14
|
|
|
@@ -47,10 +47,10 @@ class SmartPath(BasePath):
|
|
|
47
47
|
def __init__(self, path: Union[PathLike, int], *other_paths: PathLike):
|
|
48
48
|
self.path = str(path) if not isinstance(path, int) else path
|
|
49
49
|
pathlike = path
|
|
50
|
-
if not isinstance(pathlike,
|
|
50
|
+
if not isinstance(pathlike, BasePath):
|
|
51
51
|
pathlike = self._create_pathlike(path)
|
|
52
52
|
if len(other_paths) > 0:
|
|
53
|
-
pathlike = pathlike.joinpath(*other_paths)
|
|
53
|
+
pathlike = pathlike.joinpath(*other_paths)
|
|
54
54
|
self.path = str(pathlike)
|
|
55
55
|
self.pathlike = pathlike
|
|
56
56
|
|
|
@@ -73,7 +73,7 @@ class SmartPath(BasePath):
|
|
|
73
73
|
path_without_protocol = path
|
|
74
74
|
else:
|
|
75
75
|
path_without_protocol = path[len(protocol) + 3 :]
|
|
76
|
-
elif isinstance(path, (
|
|
76
|
+
elif isinstance(path, (BasePath, SmartPath)):
|
|
77
77
|
return str(path.protocol), str(path)
|
|
78
78
|
elif isinstance(path, (PurePath, BasePath)):
|
|
79
79
|
return SmartPath._extract_protocol(fspath(path))
|
|
@@ -86,14 +86,14 @@ class SmartPath(BasePath):
|
|
|
86
86
|
return protocol, path
|
|
87
87
|
|
|
88
88
|
@classmethod
|
|
89
|
-
def _create_pathlike(cls, path: Union[PathLike, int]) ->
|
|
90
|
-
protocol,
|
|
89
|
+
def _create_pathlike(cls, path: Union[PathLike, int]) -> BasePath:
|
|
90
|
+
protocol, un_aliased_path = cls._extract_protocol(path)
|
|
91
91
|
if protocol.startswith("s3+"):
|
|
92
92
|
protocol = "s3"
|
|
93
93
|
if protocol not in cls._registered_protocols:
|
|
94
94
|
raise ProtocolNotFoundError("protocol %r not found: %r" % (protocol, path))
|
|
95
95
|
path_class = cls._registered_protocols[protocol]
|
|
96
|
-
return path_class(
|
|
96
|
+
return path_class(un_aliased_path)
|
|
97
97
|
|
|
98
98
|
@classmethod
|
|
99
99
|
def register(cls, path_class, override_ok: bool = False):
|
|
@@ -145,7 +145,7 @@ class SmartPath(BasePath):
|
|
|
145
145
|
return self.pathlike.protocol
|
|
146
146
|
|
|
147
147
|
@classmethod
|
|
148
|
-
def from_uri(cls, path:
|
|
148
|
+
def from_uri(cls, path: PathLike):
|
|
149
149
|
return cls(path)
|
|
150
150
|
|
|
151
151
|
def relpath(self, start: Optional[str] = None) -> str:
|
|
@@ -155,7 +155,7 @@ class SmartPath(BasePath):
|
|
|
155
155
|
:returns: Relative path from start
|
|
156
156
|
"""
|
|
157
157
|
if start is not None:
|
|
158
|
-
_, start = SmartPath._extract_protocol(fspath(start))
|
|
158
|
+
_, start = SmartPath._extract_protocol(fspath(start)) # pyre-ignore[9]
|
|
159
159
|
return self.pathlike.relpath(start=start)
|
|
160
160
|
|
|
161
161
|
as_uri = _bind_function("as_uri")
|
|
@@ -167,17 +167,12 @@ class SmartPath(BasePath):
|
|
|
167
167
|
__fspath__ = _bind_function("__fspath__")
|
|
168
168
|
__truediv__ = _bind_function("__truediv__")
|
|
169
169
|
|
|
170
|
-
joinpath = _bind_function("joinpath")
|
|
171
170
|
is_reserved = _bind_function("is_reserved")
|
|
172
171
|
match = _bind_function("match")
|
|
173
172
|
relative_to = _bind_function("relative_to")
|
|
174
173
|
with_name = _bind_function("with_name")
|
|
175
174
|
with_suffix = _bind_function("with_suffix")
|
|
176
175
|
with_stem = _bind_function("with_stem")
|
|
177
|
-
is_absolute = _bind_function("is_absolute")
|
|
178
|
-
is_mount = _bind_function("is_mount")
|
|
179
|
-
abspath = _bind_function("abspath")
|
|
180
|
-
realpath = _bind_function("realpath")
|
|
181
176
|
iterdir = _bind_function("iterdir")
|
|
182
177
|
cwd = _bind_function("cwd")
|
|
183
178
|
home = _bind_function("home")
|
megfile/stdio.py
CHANGED
megfile/stdio_path.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import io
|
|
2
2
|
from typing import IO, Optional, Union
|
|
3
3
|
|
|
4
|
-
from megfile.interfaces import
|
|
4
|
+
from megfile.interfaces import BasePath, PathLike
|
|
5
5
|
from megfile.lib.compat import fspath
|
|
6
6
|
from megfile.lib.stdio_handler import STDReader, STDWriter
|
|
7
7
|
from megfile.lib.url import get_url_scheme
|
|
@@ -31,7 +31,7 @@ def is_stdio(path: PathLike) -> bool:
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
@SmartPath.register
|
|
34
|
-
class StdioPath(
|
|
34
|
+
class StdioPath(BasePath):
|
|
35
35
|
protocol = "stdio"
|
|
36
36
|
|
|
37
37
|
def _open(self, mode: str = "rb") -> Union[STDReader, STDWriter]:
|
megfile/utils/__init__.py
CHANGED
|
@@ -209,8 +209,7 @@ def binary_open(open_func):
|
|
|
209
209
|
def get_human_size(size_bytes: float) -> str:
|
|
210
210
|
"""Get human-readable size, e.g. `100MB`"""
|
|
211
211
|
if size_bytes < 0:
|
|
212
|
-
|
|
213
|
-
raise AssertionError("negative size: %r" % size_bytes)
|
|
212
|
+
raise ValueError("negative size: %r" % size_bytes)
|
|
214
213
|
if size_bytes == 0:
|
|
215
214
|
return "0 B"
|
|
216
215
|
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
|
|
@@ -240,7 +239,7 @@ def necessary_params(func: Callable, **kwargs):
|
|
|
240
239
|
return res_kwargs
|
|
241
240
|
|
|
242
241
|
|
|
243
|
-
def generate_cache_path(filename: str, cache_dir: str = "/tmp") -> str:
|
|
242
|
+
def generate_cache_path(filename: str, cache_dir: str = "/tmp") -> str: # nosec B108
|
|
244
243
|
suffix = os.path.splitext(filename)[1]
|
|
245
244
|
return os.path.join(cache_dir, str(uuid.uuid4()) + suffix)
|
|
246
245
|
|
|
@@ -344,5 +343,13 @@ class cached_classproperty(cached_property):
|
|
|
344
343
|
val = cls.__dict__[self.attrname]
|
|
345
344
|
if val is self:
|
|
346
345
|
val = self.func(cls)
|
|
347
|
-
setattr(cls, self.attrname, val)
|
|
346
|
+
setattr(cls, self.attrname, val) # pyre-ignore[6]
|
|
348
347
|
return val
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def is_domain_or_subdomain(sub, parent):
|
|
351
|
+
if sub == parent:
|
|
352
|
+
return True
|
|
353
|
+
if sub.endswith(f".{parent}"):
|
|
354
|
+
return True
|
|
355
|
+
return False
|
megfile/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "
|
|
1
|
+
VERSION = "4.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: megfile
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Summary: Megvii file operation library
|
|
5
5
|
Author-email: megvii <megfile@megvii.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/megvii-research/megfile
|
|
@@ -12,12 +12,12 @@ Classifier: Operating System :: POSIX :: Linux
|
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
License-File: LICENSE.pyre
|
|
@@ -27,10 +27,10 @@ Requires-Dist: requests
|
|
|
27
27
|
Requires-Dist: paramiko
|
|
28
28
|
Requires-Dist: tqdm
|
|
29
29
|
Requires-Dist: pyyaml
|
|
30
|
-
Provides-Extra: cli
|
|
31
|
-
Requires-Dist: click; extra == "cli"
|
|
32
30
|
Provides-Extra: hdfs
|
|
33
31
|
Requires-Dist: hdfs; extra == "hdfs"
|
|
32
|
+
Provides-Extra: cli
|
|
33
|
+
Requires-Dist: click; extra == "cli"
|
|
34
34
|
|
|
35
35
|
megfile - Megvii FILE library
|
|
36
36
|
---
|
|
@@ -71,7 +71,7 @@ megfile - Megvii FILE library
|
|
|
71
71
|
|
|
72
72
|
## Quick Start
|
|
73
73
|
|
|
74
|
-
Path string in `megfile` almost is `protocol://path/to/file`, for example `s3://bucketA/key`. But sftp path is a little different, format is `sftp://[username[:password]@]hostname[:port]//
|
|
74
|
+
Path string in `megfile` almost is `protocol://path/to/file`, for example `s3://bucketA/key`. But sftp path is a little different, format is `sftp://[username[:password]@]hostname[:port]//absolute_file_path`. More details see [path format document](https://megvii-research.github.io/megfile/path_format.html).
|
|
75
75
|
Here's an example of writing a file to s3 / fs, syncing to local, reading and finally deleting it.
|
|
76
76
|
|
|
77
77
|
### Functional Interface
|
|
@@ -203,7 +203,7 @@ $ megfile config s3 accesskey secretkey \
|
|
|
203
203
|
--profile tos
|
|
204
204
|
|
|
205
205
|
# create alias
|
|
206
|
-
$ megfile
|
|
206
|
+
$ megfile alias tos s3+tos
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
You can get the configuration from `~/.config/megfile/aliases.conf`, like:
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
megfile/__init__.py,sha256=i2Lbq_VxIgppaqwkxG0_H35dRfcjJ4mCYWjprOf4hHo,7318
|
|
2
|
+
megfile/cli.py,sha256=yRRd555mk-yxxg0XShnot068oEuvX1E4qY-hb-uVLcc,23549
|
|
3
|
+
megfile/config.py,sha256=kcnqVGrUKSuZ3YqLHpeJPYj94WO2SIH2S6n755lUXew,1942
|
|
4
|
+
megfile/errors.py,sha256=a55qKQgyfiLmV-qnojUFzq2gu9JXpj3ZiC2qVaWyUTA,14160
|
|
5
|
+
megfile/fs.py,sha256=dk1eVJpbuSFMvQz5EF3C4nP83GDUFweoo67h4b0sDm8,18257
|
|
6
|
+
megfile/fs_path.py,sha256=DtiCY58BGNW3hd3UqRJVSL9L6YAXDp9GKr5YpOwuy3U,39103
|
|
7
|
+
megfile/hdfs.py,sha256=JfqTTvMzTeDFAJ-uq5BU0sjFaE3qshlVZ0_5h9oImfA,13361
|
|
8
|
+
megfile/hdfs_path.py,sha256=_ir7En78K0nZudVOL7yYcKZgBQRZwlMDvWTRmYXEfOE,25637
|
|
9
|
+
megfile/http.py,sha256=1nuGe-JbnwMFyV3s35CJxByED3uoRoS9y8Y8cSGP9Kw,3865
|
|
10
|
+
megfile/http_path.py,sha256=c-xAu5wDxcTevmIUmrNEy-m-QiCfDJToaVI7y8SVIUI,14492
|
|
11
|
+
megfile/interfaces.py,sha256=p4UvVZpeLx5djd6bqqDaygIx_s-_AxIVj-gudTch4JE,8467
|
|
12
|
+
megfile/pathlike.py,sha256=vfuTBqSTIciRxkkqMfLfnBxWTEl9yns1yR8zgK4Raw0,31268
|
|
13
|
+
megfile/s3.py,sha256=zqAegH5tijcztEKcfHXmOYhAR880nTxaAzc2O0JJnjc,16661
|
|
14
|
+
megfile/s3_path.py,sha256=oBA9GdOseEtQJmh7LMDOf1sGamsEERs6Sm1jHpdksO8,93343
|
|
15
|
+
megfile/sftp.py,sha256=WP7soS6WuSzHPc72iRHklkBoQG_4lNPbOCGwEy2Zwhw,24075
|
|
16
|
+
megfile/sftp_path.py,sha256=jzLEt1RnzX00GCApyy1NSCGj7eQKen_bz0DETD6oVyg,43565
|
|
17
|
+
megfile/smart.py,sha256=WS9ZZbMAMPrOR2z8sb8hxVYCVsCRMhGGUvcboQjCkBw,36771
|
|
18
|
+
megfile/smart_path.py,sha256=Bqg95T2-XZrRXWhH7GT-jMCYzD7i1SIXdczQxtOxiPs,7583
|
|
19
|
+
megfile/stdio.py,sha256=C_cGID_npthpwoPcsJMMEqqbVUPUnDxxJV9jLY2_D7c,635
|
|
20
|
+
megfile/stdio_path.py,sha256=L8ODNIwO79UIv13YYc2OTr6f4XTv4ZPyvBeRk83-AjA,2700
|
|
21
|
+
megfile/version.py,sha256=J6itPRI_4KX0lL-kzbVVoP2dVj3dxQHoPTBfGHYxUOE,19
|
|
22
|
+
megfile/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
megfile/lib/base_prefetch_reader.py,sha256=6Dy2ZwlowqAvyUUa7bpQLCKOclmmUDhqEF-_CDDp0Og,13100
|
|
24
|
+
megfile/lib/combine_reader.py,sha256=nKGAug29lOpNIZuLKu7_qVrJJRpXL_J4jxLglWbGJ1w,4808
|
|
25
|
+
megfile/lib/compare.py,sha256=n_dtLxgoskYnsIZMKdKmVhQoVn8qYUrUhkS1JH2_X3o,2170
|
|
26
|
+
megfile/lib/compat.py,sha256=SynEeHluys3tCK-lb_1oV3o_ft83yZvunqM_AjibLgE,207
|
|
27
|
+
megfile/lib/fnmatch.py,sha256=4MvGzEahMRA-u8Z7mxaD-Yw1idOwBoJJpVywQy29jwY,4162
|
|
28
|
+
megfile/lib/glob.py,sha256=aTK2aFyFobUs0W4deB4iASgtuq6DAE1jILmcAiP8Cb4,9840
|
|
29
|
+
megfile/lib/hdfs_prefetch_reader.py,sha256=yCNpcXcTiC2SHKHC-Qp50KQx1ObSLmOgwNUKlG-4ADg,2131
|
|
30
|
+
megfile/lib/hdfs_tools.py,sha256=4K-OdMYFFSLBGmDzjatioHvuZuUbKVy7ACeJl-l0HLQ,435
|
|
31
|
+
megfile/lib/http_prefetch_reader.py,sha256=OjP5pdWK_e1QiFIt2xmflceLnrz3S7B7ePBZFK-OwQE,4558
|
|
32
|
+
megfile/lib/joinpath.py,sha256=gaPNtBi8fzd5LZNyZp5zrHzaybcqKJ1xlntGmVNyFEM,929
|
|
33
|
+
megfile/lib/lazy_handler.py,sha256=bE7RGt1x_xYWMgGAvHr7dwEt52qy-D3z90X3oyCvE6g,1875
|
|
34
|
+
megfile/lib/s3_buffered_writer.py,sha256=Oztz1dyxTX6nkErmJZUAMiQcvXzHJmky2hO35mg4UFM,7787
|
|
35
|
+
megfile/lib/s3_cached_handler.py,sha256=X8PdeRC-BY6eSmOO5f2BeyjTPxyEwNtHgmAm9VgmDR4,1426
|
|
36
|
+
megfile/lib/s3_limited_seekable_writer.py,sha256=mUeoTS98LHluwDN7zxdCVcsjOGBT1bOYV8nRvi9QMGE,6212
|
|
37
|
+
megfile/lib/s3_memory_handler.py,sha256=4uzBzz2jfRI_u6jl0CpOGAhpNJhDQo18FSAweauCUFs,4136
|
|
38
|
+
megfile/lib/s3_pipe_handler.py,sha256=dm7NnZd1Ym5ABS1GvOQtoCJEO_CB8e6p4sUhLiid0go,3622
|
|
39
|
+
megfile/lib/s3_prefetch_reader.py,sha256=wnc-0K6USDBXKgVRZtp-W8aWf5J87J_ediJK6IJWLho,4332
|
|
40
|
+
megfile/lib/s3_share_cache_reader.py,sha256=LVWKxHdHo0_zUIW4o8yqNvplqqwezUPeYEt02Vj-WNM,3754
|
|
41
|
+
megfile/lib/shadow_handler.py,sha256=TntewlvIW9ZxCfmqASDQREHoiZ8v42faOe9sovQYQz0,2779
|
|
42
|
+
megfile/lib/stdio_handler.py,sha256=IDdgENLQlhigEwkLL4zStueVSzdWg7xVcTF_koof_Ek,1987
|
|
43
|
+
megfile/lib/url.py,sha256=ER32pWy9Q2MAk3TraAaNEBWIqUeBmLuM57ol2cs7-Ks,103
|
|
44
|
+
megfile/utils/__init__.py,sha256=sATf_NlsSTYIMEiA8-gM6K1M-Q1K6_7rx2VM31hrqaA,10838
|
|
45
|
+
megfile/utils/mutex.py,sha256=asb8opGLgK22RiuBJUnfsvB8LnMmodP8KzCVHKmQBWA,2561
|
|
46
|
+
megfile-4.0.0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
47
|
+
megfile-4.0.0.dist-info/LICENSE.pyre,sha256=9lf5nT-5ZH25JijpYAequ0bl8E8z5JmZB1qrjiUMp84,1080
|
|
48
|
+
megfile-4.0.0.dist-info/METADATA,sha256=-vM4Od_ui6AY8apEGJPxIICdJtIY8dl9nN7cajLvvik,9228
|
|
49
|
+
megfile-4.0.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
50
|
+
megfile-4.0.0.dist-info/entry_points.txt,sha256=M6ZWSSv5_5_QtIpZafy3vq7WuOJ_5dSGQQnEZbByt2Q,49
|
|
51
|
+
megfile-4.0.0.dist-info/top_level.txt,sha256=IaHHoRXeemLL6kTM5YuC3H0UyOnTdZH9J324TkeBneo,36
|
|
52
|
+
megfile-4.0.0.dist-info/RECORD,,
|
docs/conf.py
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Configuration file for the Sphinx documentation builder.
|
|
2
|
-
|
|
3
|
-
# This file only contains a selection of the most common options. For a full
|
|
4
|
-
# list see the documentation:
|
|
5
|
-
# http://www.sphinx-doc.org/en/master/config
|
|
6
|
-
|
|
7
|
-
# -- Path setup --------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
# If extensions (or modules to document with autodoc) are in another directory,
|
|
10
|
-
# add these directories to sys.path here. If the directory is relative to the
|
|
11
|
-
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
12
|
-
|
|
13
|
-
# -- Project information -----------------------------------------------------
|
|
14
|
-
|
|
15
|
-
project = 'megfile'
|
|
16
|
-
copyright = '2019, r-eng'
|
|
17
|
-
author = 'r-eng'
|
|
18
|
-
|
|
19
|
-
# -- General configuration ---------------------------------------------------
|
|
20
|
-
|
|
21
|
-
# Add any Sphinx extension module names here, as strings. They can be
|
|
22
|
-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
23
|
-
# ones.
|
|
24
|
-
extensions = [
|
|
25
|
-
'sphinx.ext.autodoc',
|
|
26
|
-
'sphinx.ext.viewcode',
|
|
27
|
-
'sphinx.ext.todo',
|
|
28
|
-
'm2r2',
|
|
29
|
-
'sphinx_rtd_theme',
|
|
30
|
-
'sphinx_click',
|
|
31
|
-
'sphinxcontrib.jquery',
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
# Add any paths that contain templates here, relative to this directory.
|
|
35
|
-
templates_path = ['_templates']
|
|
36
|
-
|
|
37
|
-
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
38
|
-
# for a list of supported languages.
|
|
39
|
-
|
|
40
|
-
# This is also used if you do content translation via gettext catalogs.
|
|
41
|
-
# Usually you set "language" from the command line for these cases.
|
|
42
|
-
language = 'en'
|
|
43
|
-
|
|
44
|
-
# List of patterns, relative to source directory, that match files and
|
|
45
|
-
# directories to ignore when looking for source files.
|
|
46
|
-
# This pattern also affects html_static_path and html_extra_path.
|
|
47
|
-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
48
|
-
|
|
49
|
-
# -- Options for HTML output -------------------------------------------------
|
|
50
|
-
|
|
51
|
-
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
52
|
-
# a list of builtin themes.
|
|
53
|
-
html_theme = "sphinx_rtd_theme"
|
|
54
|
-
|
|
55
|
-
# Add any paths that contain custom static files (such as style sheets) here,
|
|
56
|
-
# relative to this directory. They are copied after the builtin static files,
|
|
57
|
-
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
58
|
-
html_static_path = ['_static']
|
|
59
|
-
|
|
60
|
-
# -- Extension configuration -------------------------------------------------
|
|
61
|
-
|
|
62
|
-
# -- Options for todo extension ----------------------------------------------
|
|
63
|
-
|
|
64
|
-
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
65
|
-
todo_include_todos = True
|
megfile-3.1.6.dist-info/RECORD
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
docs/conf.py,sha256=sfDSly5jO8W_RmuAptOIp4hd8dNcO-9a5XrHTbxFnNo,2448
|
|
2
|
-
megfile/__init__.py,sha256=i2Lbq_VxIgppaqwkxG0_H35dRfcjJ4mCYWjprOf4hHo,7318
|
|
3
|
-
megfile/cli.py,sha256=0Sgbz3jeUryVll9Aa6R0MpJdQJUGENvz55YF7Jm1Uxc,23482
|
|
4
|
-
megfile/config.py,sha256=_SkJRaVWUdfW1Q9uX0vao-6YVQKJtfej22Z8DykuRps,2331
|
|
5
|
-
megfile/errors.py,sha256=a55qKQgyfiLmV-qnojUFzq2gu9JXpj3ZiC2qVaWyUTA,14160
|
|
6
|
-
megfile/fs.py,sha256=dgj5fW-EEzQNdjMF2tkB5DjXu3iHQbtLi5PSIMxR8fc,11966
|
|
7
|
-
megfile/fs_path.py,sha256=Ffvukc176beH5aQMZXXtwH6ApwLYXPViCIUP0pijgT0,41590
|
|
8
|
-
megfile/hdfs.py,sha256=latguOuuzAmg-yWOy3Sm723CJ0ybN_eSHRubVNqhcMU,9202
|
|
9
|
-
megfile/hdfs_path.py,sha256=0XLtABufwqL-y8igOxzOJz6zOGppuBp2f2SwXIMvvYg,27299
|
|
10
|
-
megfile/http.py,sha256=2Z2yqyhU-zcJCJwSNyBsxsZ7f2FT9X6fcednsbHDsFM,2025
|
|
11
|
-
megfile/http_path.py,sha256=BhMNjQVB85IaCGGIKzgEfY73mAVdCzJP08W1RuGeMRA,16119
|
|
12
|
-
megfile/interfaces.py,sha256=7C53Q2FAVFmOEnplfplvWqHab29HJE5RQnpfdb4loVY,8679
|
|
13
|
-
megfile/pathlike.py,sha256=5VAKIArm2UqrpMBJMoNAEydFxLd1mjCZ8iQnKFUIYu0,31274
|
|
14
|
-
megfile/s3.py,sha256=7SdfLjAePVh-bpRyuj566VB4Qa7KP86rCJGzYANR7wQ,13008
|
|
15
|
-
megfile/s3_path.py,sha256=x-_wxVvVpv56LtDOwRAWJCOq3XMk7oAB6xdi22TBlmY,95029
|
|
16
|
-
megfile/sftp.py,sha256=vyDnYXX3i1j2fhXMC8YCeX-66MDb9wrBQQjQVhZx0uo,13004
|
|
17
|
-
megfile/sftp_path.py,sha256=4tByWvUJK1KBJoa3t5aoWYnZpaRWN9nQIE6ZyiGHrbk,53519
|
|
18
|
-
megfile/smart.py,sha256=Vr4R7HpjXjt587KOc2-1QGbQ5EsZ48YRzCaK0rz3IS0,36108
|
|
19
|
-
megfile/smart_path.py,sha256=Wsn6fR9g7NTwNwwvZ_0H39NLHIlOLnCqK-ZY0n5CvKk,7812
|
|
20
|
-
megfile/stdio.py,sha256=UYe-h440Wc4f5COOzOTG1svnp5nFzrfpixehJ0_0_NY,653
|
|
21
|
-
megfile/stdio_path.py,sha256=7jzVdreamO18yBWZM7Pp71cO7GmrYb0M0qyQde2Ypq4,2706
|
|
22
|
-
megfile/version.py,sha256=GfRGwuY_9YYywKtd8Nc8lbkE6hlfX3NUsNtuHN-c8Gs,19
|
|
23
|
-
megfile/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
megfile/lib/base_prefetch_reader.py,sha256=CaYWuiKmlk4Utr0IFDPwPC58wV2jBAhqpxhwhRHc734,13652
|
|
25
|
-
megfile/lib/combine_reader.py,sha256=uSzo3PmhD5ck6_Vv6dFU5vVx4boeA97VS-puPyhF_BE,4657
|
|
26
|
-
megfile/lib/compare.py,sha256=n_dtLxgoskYnsIZMKdKmVhQoVn8qYUrUhkS1JH2_X3o,2170
|
|
27
|
-
megfile/lib/compat.py,sha256=SynEeHluys3tCK-lb_1oV3o_ft83yZvunqM_AjibLgE,207
|
|
28
|
-
megfile/lib/fnmatch.py,sha256=4MvGzEahMRA-u8Z7mxaD-Yw1idOwBoJJpVywQy29jwY,4162
|
|
29
|
-
megfile/lib/glob.py,sha256=iJ0NvFh7b07MDru36YY1j3ZWPCNBLAECzUkoqYfJWgY,10052
|
|
30
|
-
megfile/lib/hdfs_prefetch_reader.py,sha256=UrcUmTM1IZwD95oZMJXuY2dYEpE7uUjs_6dHyTMYDbg,2129
|
|
31
|
-
megfile/lib/hdfs_tools.py,sha256=4K-OdMYFFSLBGmDzjatioHvuZuUbKVy7ACeJl-l0HLQ,435
|
|
32
|
-
megfile/lib/http_prefetch_reader.py,sha256=PibR9Mx4JSdhkB4p8WzD3i2f__Txv55VBtPOmhml3vM,4556
|
|
33
|
-
megfile/lib/joinpath.py,sha256=gaPNtBi8fzd5LZNyZp5zrHzaybcqKJ1xlntGmVNyFEM,929
|
|
34
|
-
megfile/lib/lazy_handler.py,sha256=bE7RGt1x_xYWMgGAvHr7dwEt52qy-D3z90X3oyCvE6g,1875
|
|
35
|
-
megfile/lib/s3_buffered_writer.py,sha256=V2nMdA3sB8XV6q5OqWFBZhPrzkw1ZUMM81k2uDPNn24,7087
|
|
36
|
-
megfile/lib/s3_cached_handler.py,sha256=QrQKck06ye16o7GD71T-fVCseKlOhsxp82LtBTtAKJU,1498
|
|
37
|
-
megfile/lib/s3_limited_seekable_writer.py,sha256=v-e7rfFBfWCSQVtJIaFHM_i0Hb1FkfVLHlhawo5MOIk,6358
|
|
38
|
-
megfile/lib/s3_memory_handler.py,sha256=NGKWbI4LG2cmV06CP7KOVPqS_BNpm3ApqKi5ibgIBvQ,4208
|
|
39
|
-
megfile/lib/s3_pipe_handler.py,sha256=DY1UTNCq8oD3QWXNb4orOiz3EoEAo6dhwmZZdk6h1bU,3694
|
|
40
|
-
megfile/lib/s3_prefetch_reader.py,sha256=YZA6JOQXcioREh_z1E-kZ2WRPTm02v0dCEVqyaOMHns,4287
|
|
41
|
-
megfile/lib/s3_share_cache_reader.py,sha256=jhGL1B6NPv68cQnW1Jf7ey-zTQ8XfiJg5ILDNgRWHy0,3671
|
|
42
|
-
megfile/lib/shadow_handler.py,sha256=TntewlvIW9ZxCfmqASDQREHoiZ8v42faOe9sovQYQz0,2779
|
|
43
|
-
megfile/lib/stdio_handler.py,sha256=IDdgENLQlhigEwkLL4zStueVSzdWg7xVcTF_koof_Ek,1987
|
|
44
|
-
megfile/lib/url.py,sha256=ER32pWy9Q2MAk3TraAaNEBWIqUeBmLuM57ol2cs7-Ks,103
|
|
45
|
-
megfile/utils/__init__.py,sha256=9rD_SoD--XWt7-EJi5-L80Y7YeoFdr-tUp-5ATB85oA,10717
|
|
46
|
-
megfile/utils/mutex.py,sha256=asb8opGLgK22RiuBJUnfsvB8LnMmodP8KzCVHKmQBWA,2561
|
|
47
|
-
scripts/convert_results_to_sarif.py,sha256=nDiOfsedb22Ps7ZodmYdlXZlxv54fRxCQgOZsB2OkNk,2833
|
|
48
|
-
scripts/generate_file.py,sha256=-mTcBiqiQ1juvqojVfVZ-uZWgpANHJNdhrF7s68zNfc,10903
|
|
49
|
-
megfile-3.1.6.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
50
|
-
megfile-3.1.6.dist-info/LICENSE.pyre,sha256=9lf5nT-5ZH25JijpYAequ0bl8E8z5JmZB1qrjiUMp84,1080
|
|
51
|
-
megfile-3.1.6.dist-info/METADATA,sha256=XuomkBWbASrj60L6untH8oN32sNezHse1WfuPetTpYg,9178
|
|
52
|
-
megfile-3.1.6.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
53
|
-
megfile-3.1.6.dist-info/entry_points.txt,sha256=M6ZWSSv5_5_QtIpZafy3vq7WuOJ_5dSGQQnEZbByt2Q,49
|
|
54
|
-
megfile-3.1.6.dist-info/top_level.txt,sha256=oTnYXo1Z3V61qSWAKtnY9RkDgRSHvfRN38FQae6E0W0,50
|
|
55
|
-
megfile-3.1.6.dist-info/RECORD,,
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
|
|
4
|
-
# This source code is licensed under the MIT license found in the
|
|
5
|
-
# LICENSE.pyre file in the root directory of this source tree.
|
|
6
|
-
|
|
7
|
-
import json
|
|
8
|
-
import logging
|
|
9
|
-
import sys
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
from typing import Any, Dict, List
|
|
12
|
-
|
|
13
|
-
LOG: logging.Logger = logging.getLogger(__name__)
|
|
14
|
-
|
|
15
|
-
Error = Dict[str, Any]
|
|
16
|
-
Location = Dict[str, Any]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _locations(errors: List[Error]) -> Dict[str, Location]:
|
|
20
|
-
locations = {
|
|
21
|
-
error["path"]: {"uri": f"file://{Path.cwd() / error['path']}", "index": 0}
|
|
22
|
-
for error in errors
|
|
23
|
-
}
|
|
24
|
-
for index, location in enumerate(locations.values()):
|
|
25
|
-
location["index"] = index
|
|
26
|
-
return locations
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _to_sarif_result(error: Error, locations: Dict[str, Location]) -> Dict[str, Any]:
|
|
30
|
-
LOG.info(f"Transforming:\n{error}")
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
"ruleId": "type-error",
|
|
34
|
-
"ruleIndex": 0,
|
|
35
|
-
"level": "error",
|
|
36
|
-
"message": {"text": error["description"]},
|
|
37
|
-
"locations": [
|
|
38
|
-
{
|
|
39
|
-
"physicalLocation": {
|
|
40
|
-
"artifactLocation": locations[error["path"]],
|
|
41
|
-
"region": {
|
|
42
|
-
"startLine": error["line"],
|
|
43
|
-
"startColumn": error["column"] + 1,
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def _to_sarif(errors: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
52
|
-
LOG.info(f"Transforming:\n{errors}")
|
|
53
|
-
locations = _locations(errors)
|
|
54
|
-
return {
|
|
55
|
-
"version": "2.1.0",
|
|
56
|
-
"$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4",
|
|
57
|
-
"runs": [
|
|
58
|
-
{
|
|
59
|
-
"tool": {
|
|
60
|
-
"driver": {
|
|
61
|
-
"name": "Pyre",
|
|
62
|
-
"informationUri": "https://www.pyre-check.org",
|
|
63
|
-
"rules": [
|
|
64
|
-
{
|
|
65
|
-
"id": "type-error",
|
|
66
|
-
"shortDescription": {"text": "Type Error"},
|
|
67
|
-
"helpUri": "https://www.pyre-check.org",
|
|
68
|
-
"help": {"text": "Pyre is a type checker for Python"},
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"artifacts": [
|
|
74
|
-
{"location": location}
|
|
75
|
-
for location in sorted(
|
|
76
|
-
locations.values(), key=lambda location: location["index"]
|
|
77
|
-
)
|
|
78
|
-
],
|
|
79
|
-
"results": [_to_sarif_result(error, locations) for error in errors],
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if __name__ == "__main__":
|
|
86
|
-
logging.basicConfig(
|
|
87
|
-
format="%(asctime)s [%(levelname)s] %(message)s", level=logging.DEBUG
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
sarif = _to_sarif(json.load(sys.stdin))
|
|
91
|
-
json.dump(sarif, sys.stdout, indent=4)
|