megfile 3.0.1__py3-none-any.whl → 3.0.2.post1__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 +22 -2
- megfile/s3_path.py +4 -1
- megfile/sftp_path.py +2 -0
- megfile/smart.py +12 -4
- megfile/version.py +1 -1
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/METADATA +1 -1
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/RECORD +12 -12
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/LICENSE +0 -0
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/LICENSE.pyre +0 -0
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/WHEEL +0 -0
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/entry_points.txt +0 -0
- {megfile-3.0.1.dist-info → megfile-3.0.2.post1.dist-info}/top_level.txt +0 -0
megfile/cli.py
CHANGED
|
@@ -443,7 +443,12 @@ def head(path: str, lines: int):
|
|
|
443
443
|
type=click.INT,
|
|
444
444
|
default=10,
|
|
445
445
|
help='print the last NUM lines')
|
|
446
|
-
|
|
446
|
+
@click.option(
|
|
447
|
+
'-f',
|
|
448
|
+
'--follow',
|
|
449
|
+
is_flag=True,
|
|
450
|
+
help='output appended data as the file grows')
|
|
451
|
+
def tail(path: str, lines: int, follow: bool):
|
|
447
452
|
line_list = []
|
|
448
453
|
with smart_open(path, 'rb') as f:
|
|
449
454
|
f.seek(0, os.SEEK_END)
|
|
@@ -464,8 +469,23 @@ def tail(path: str, lines: int):
|
|
|
464
469
|
break
|
|
465
470
|
else:
|
|
466
471
|
line_list = block_lines
|
|
467
|
-
|
|
472
|
+
|
|
473
|
+
for line in line_list[:-1]:
|
|
468
474
|
click.echo(line)
|
|
475
|
+
if line_list:
|
|
476
|
+
click.echo(line_list[-1], nl=False)
|
|
477
|
+
|
|
478
|
+
if follow:
|
|
479
|
+
offset = file_size
|
|
480
|
+
while True:
|
|
481
|
+
with smart_open(path, 'rb') as f:
|
|
482
|
+
f.seek(offset)
|
|
483
|
+
line = f.readline()
|
|
484
|
+
offset = f.tell()
|
|
485
|
+
if not line:
|
|
486
|
+
time.sleep(1)
|
|
487
|
+
continue
|
|
488
|
+
click.echo(line, nl=False)
|
|
469
489
|
|
|
470
490
|
|
|
471
491
|
@cli.command(short_help='Write bytes from stdin to file.')
|
megfile/s3_path.py
CHANGED
|
@@ -461,7 +461,10 @@ def _s3_glob_stat_single_path(
|
|
|
461
461
|
return False
|
|
462
462
|
|
|
463
463
|
def create_generator(_s3_pathname) -> Iterator[FileEntry]:
|
|
464
|
-
|
|
464
|
+
top_dir_with_profile = top_dir
|
|
465
|
+
if profile_name:
|
|
466
|
+
top_dir_with_profile = f's3+{profile_name}://{top_dir[5:]}'
|
|
467
|
+
if not S3Path(top_dir_with_profile).exists():
|
|
465
468
|
return
|
|
466
469
|
if not has_magic(_s3_pathname):
|
|
467
470
|
_s3_pathname_obj = S3Path(_s3_pathname)
|
megfile/sftp_path.py
CHANGED
|
@@ -1122,6 +1122,8 @@ class SftpPath(URIPath):
|
|
|
1122
1122
|
if not self.is_symlink():
|
|
1123
1123
|
raise OSError('Not a symlink: %s' % self.path_with_protocol)
|
|
1124
1124
|
path = self._client.readlink(self._real_path)
|
|
1125
|
+
if not path:
|
|
1126
|
+
raise OSError('Not a symlink: %s' % self.path_with_protocol)
|
|
1125
1127
|
if not path.startswith('/'):
|
|
1126
1128
|
return self.parent.joinpath(path)
|
|
1127
1129
|
return self._generate_path_object(path)
|
megfile/smart.py
CHANGED
|
@@ -7,7 +7,7 @@ from typing import IO, Any, AnyStr, BinaryIO, Callable, Iterable, Iterator, List
|
|
|
7
7
|
|
|
8
8
|
from tqdm import tqdm
|
|
9
9
|
|
|
10
|
-
from megfile.errors import
|
|
10
|
+
from megfile.errors import S3UnknownError
|
|
11
11
|
from megfile.fs import fs_copy, is_fs
|
|
12
12
|
from megfile.interfaces import Access, ContextIterator, FileCacher, FileEntry, NullCacher, PathLike, StatResult
|
|
13
13
|
from megfile.lib.combine_reader import CombineReader
|
|
@@ -331,9 +331,17 @@ def smart_copy(
|
|
|
331
331
|
copy_func = _copy_funcs[src_protocol][dst_protocol]
|
|
332
332
|
except KeyError:
|
|
333
333
|
copy_func = _default_copy_func
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
try:
|
|
335
|
+
copy_func(
|
|
336
|
+
src_path, dst_path, callback=callback,
|
|
337
|
+
followlinks=followlinks) # type: ignore
|
|
338
|
+
except S3UnknownError as e:
|
|
339
|
+
if 'cannot schedule new futures after interpreter shutdown' in str(e):
|
|
340
|
+
_default_copy_func(
|
|
341
|
+
src_path, dst_path, callback=callback,
|
|
342
|
+
followlinks=followlinks) # type: ignore
|
|
343
|
+
else:
|
|
344
|
+
raise
|
|
337
345
|
|
|
338
346
|
|
|
339
347
|
def _smart_sync_single_file(items: dict):
|
megfile/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "3.0.
|
|
1
|
+
VERSION = "3.0.2.post1"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
megfile/__init__.py,sha256=MT8SIXsmEUvtSpd1GHv6e3fFfR1gRnlEdkNNqv3gngo,6534
|
|
2
|
-
megfile/cli.py,sha256=
|
|
2
|
+
megfile/cli.py,sha256=yB2VnSaxrjNS67KL6CYRaMo72VNgyvuxCXuSfcGu6hM,21880
|
|
3
3
|
megfile/config.py,sha256=Mz91CpRJJtepidOPXs98wYskmbbHRByG1VCeKJ81kVg,658
|
|
4
4
|
megfile/errors.py,sha256=Sbx3UEKnzuyUmB1tFU9cZv61Yr4dRa79J6D0UMmkvj4,13323
|
|
5
5
|
megfile/fs.py,sha256=OfY0z4GSl8fT3mDGdeqP2hWFsd1QJl-h8RkSbg6-M8I,11547
|
|
@@ -11,14 +11,14 @@ megfile/http_path.py,sha256=ciqS32V0G3A7GVOU_lqVzRjZeyr9skXfsU87SPrkyS4,11396
|
|
|
11
11
|
megfile/interfaces.py,sha256=h3tWE8hVt5S-HopaMAX6lunPJ97vzhv6jH_2HubcDNc,6219
|
|
12
12
|
megfile/pathlike.py,sha256=Ere6tMf2nsI7bDsZo0WBzl_2HRrS_4iKOpYp0zZltAU,29487
|
|
13
13
|
megfile/s3.py,sha256=siBZfveWX1TDA4Mp41UvugcG3zlrhl_iPUbixUp1TmI,12352
|
|
14
|
-
megfile/s3_path.py,sha256=
|
|
14
|
+
megfile/s3_path.py,sha256=Rkl3cppYn8Ri1nTd_ILts0bHwtkhaLTMzj-q2pWxvEA,90940
|
|
15
15
|
megfile/sftp.py,sha256=JCkF2v1ZbHuIy_Bg3l85AesjFDimDzx9Gh1gRoMsahc,12524
|
|
16
|
-
megfile/sftp_path.py,sha256=
|
|
17
|
-
megfile/smart.py,sha256=
|
|
16
|
+
megfile/sftp_path.py,sha256=ErPKmwgaCOvvhp3aKhqX9WKIAGbWR30QUWvptQWtag8,51666
|
|
17
|
+
megfile/smart.py,sha256=y5Dzr7_f0jS2FJDF4tWbEO4SPf39zqYftqkVgMhiJds,33725
|
|
18
18
|
megfile/smart_path.py,sha256=Y0UFh4J2ccydRY2W-wX2ubaf9zzJx1M2nf-VLBGe4mk,6749
|
|
19
19
|
megfile/stdio.py,sha256=yRhlfUA2DHi3bq-9cXsSlbLCnHvS_zvglO2IYYyPsGc,707
|
|
20
20
|
megfile/stdio_path.py,sha256=eQulTXUwHvUKA-5PKCGfVNiEPkJhG9YtVhtU58OcmoM,2873
|
|
21
|
-
megfile/version.py,sha256=
|
|
21
|
+
megfile/version.py,sha256=dhVp6aZyv8wvEr5NjELL4oQ0Jg_1yxifeqUh9OuUM_c,25
|
|
22
22
|
megfile/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
megfile/lib/base_prefetch_reader.py,sha256=9HT0tcgXa95BdbyclpDEDw8WwKi6091GRQerS90-pjE,13191
|
|
24
24
|
megfile/lib/combine_reader.py,sha256=XFSqEY5A5X5Uf7eQ6AXAzrvNteESSXvKNVPktGjo3KY,4546
|
|
@@ -43,10 +43,10 @@ megfile/lib/stdio_handler.py,sha256=QDWtcZxz-hzi-rqQUiSlR3NrihX1fjK_Rj9T2mdTFEg,
|
|
|
43
43
|
megfile/lib/url.py,sha256=VbQLjo0s4AaV0iSk66BcjI68aUTcN9zBZ5x6-cM4Qvs,103
|
|
44
44
|
megfile/utils/__init__.py,sha256=qdX8FF_dYFKwp1BIWx3JeSGd91s7AKUDSEpDv9tORcM,9162
|
|
45
45
|
megfile/utils/mutex.py,sha256=-2KH3bNovKRd9zvsXq9n3bWM7rQdoG9hO7tUPxVG_Po,2538
|
|
46
|
-
megfile-3.0.
|
|
47
|
-
megfile-3.0.
|
|
48
|
-
megfile-3.0.
|
|
49
|
-
megfile-3.0.
|
|
50
|
-
megfile-3.0.
|
|
51
|
-
megfile-3.0.
|
|
52
|
-
megfile-3.0.
|
|
46
|
+
megfile-3.0.2.post1.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
47
|
+
megfile-3.0.2.post1.dist-info/LICENSE.pyre,sha256=9lf5nT-5ZH25JijpYAequ0bl8E8z5JmZB1qrjiUMp84,1080
|
|
48
|
+
megfile-3.0.2.post1.dist-info/METADATA,sha256=qDIxaqhLqBlaV0b6GCn0e7OJr0p6phvlFIhPeqpm508,8922
|
|
49
|
+
megfile-3.0.2.post1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
50
|
+
megfile-3.0.2.post1.dist-info/entry_points.txt,sha256=M6ZWSSv5_5_QtIpZafy3vq7WuOJ_5dSGQQnEZbByt2Q,49
|
|
51
|
+
megfile-3.0.2.post1.dist-info/top_level.txt,sha256=i3rMgdU1ZAJekAceojhA-bkm3749PzshtRmLTbeLUPQ,8
|
|
52
|
+
megfile-3.0.2.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|