cloud-files 5.1.3__py3-none-any.whl → 5.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 5.1.3
3
+ Version: 5.3.0
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
@@ -4,9 +4,9 @@ cloudfiles/compression.py,sha256=WXJHnoNLJ_NWyoY9ygZmFA2qMou35_9xS5dzF7-2H-M,626
4
4
  cloudfiles/connectionpools.py,sha256=aL8RiSjRepECfgAFmJcz80aJFKbou7hsbuEgugDKwB8,4814
5
5
  cloudfiles/exceptions.py,sha256=N0oGQNG-St6RvnT8e5p_yC_E61q2kgAe2scwAL0F49c,843
6
6
  cloudfiles/gcs.py,sha256=unqu5KxGKaPq6N4QeHSpCDdtnK1BzPOAerTZ8FLt2_4,3820
7
- cloudfiles/interfaces.py,sha256=8Gez-1q1Ulb6p_qSfydwAKXvJybVi-QS0yfkvSnm44I,43862
8
- cloudfiles/lib.py,sha256=9YFGMCy0mi23baqtsr-f5Gd1ewAGvD7x3UVNt772Z9E,5317
9
- cloudfiles/paths.py,sha256=4B3qWjR2TP8wAYK4NLw-iy2KUn3VNspKp6_Vy4j3I8A,11592
7
+ cloudfiles/interfaces.py,sha256=f_7doKCiI_8--ghsQJvh8f5HhAn5u3haSlPHlxi_jbw,43949
8
+ cloudfiles/lib.py,sha256=HHjCvjmOjA0nZWSvHGoSeYpxqd6FAG8xk8LM212LAUA,5382
9
+ cloudfiles/paths.py,sha256=ZfdFvbQoFiGgICPM4cjT2TzfP6vf3WEcj31aKON6IwE,12120
10
10
  cloudfiles/resumable_tools.py,sha256=NyuSoGh1SaP5akrHCpd9kgy2-JruEWrHW9lvJxV7jpE,6711
11
11
  cloudfiles/scheduler.py,sha256=DqDANmOpB3NdzFgJDNMMibRIkCrXQqIh2XGL8GWoc9c,3668
12
12
  cloudfiles/secrets.py,sha256=791b5a8nWSBYtlleGzKeoYIR5jl-FI1bw6INRM4Wy-0,5295
@@ -16,11 +16,11 @@ cloudfiles/typing.py,sha256=f3ZYkNfN9poxhGu5j-P0KCxjCCqSn9HAg5KiIPkjnCg,416
16
16
  cloudfiles_cli/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
17
17
  cloudfiles_cli/__init__.py,sha256=Wftt3R3F21QsHtWqx49ODuqT9zcSr0em7wk48kcH0WM,29
18
18
  cloudfiles_cli/cloudfiles_cli.py,sha256=_2Amjp3vsdq7vQgF2utD6BJqjOPKXOTjrJyehnlojpQ,34893
19
- cloud_files-5.1.3.dist-info/AUTHORS,sha256=BFVmobgAhaVFI5fqbuqAY5XmBQxe09ZZAsAOTy87hKQ,318
20
- cloud_files-5.1.3.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
- cloud_files-5.1.3.dist-info/METADATA,sha256=A_TQG-p83SU5RibMDyRfKcM4BoC3pcf6IbgEn_inzVw,27047
22
- cloud_files-5.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
- cloud_files-5.1.3.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
- cloud_files-5.1.3.dist-info/pbr.json,sha256=r_OnVuWLj4u5oFTro4Tjb60qKNAK2AAaXCkaI-MB24w,46
25
- cloud_files-5.1.3.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
- cloud_files-5.1.3.dist-info/RECORD,,
19
+ cloud_files-5.3.0.dist-info/AUTHORS,sha256=BFVmobgAhaVFI5fqbuqAY5XmBQxe09ZZAsAOTy87hKQ,318
20
+ cloud_files-5.3.0.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
+ cloud_files-5.3.0.dist-info/METADATA,sha256=1HXttAwASLRFMS8iNv1QRINsogpXsl9Rjyxk64sP9Wo,27047
22
+ cloud_files-5.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
+ cloud_files-5.3.0.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
+ cloud_files-5.3.0.dist-info/pbr.json,sha256=r9Ai82ya_B5fCQC8kg4ALYvsm03ts0oj1LsLzlNP_C0,46
25
+ cloud_files-5.3.0.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
+ cloud_files-5.3.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "93552c4", "is_release": true}
cloudfiles/interfaces.py CHANGED
@@ -1189,10 +1189,13 @@ class S3Interface(StorageInterface):
1189
1189
  **attrs
1190
1190
  )
1191
1191
  else:
1192
+ if isinstance(content, str):
1193
+ content = content.encode('utf8')
1194
+
1192
1195
  attrs['Bucket'] = self._path.bucket
1193
1196
  attrs['Body'] = content
1194
1197
  attrs['Key'] = key
1195
- attrs["ChecksumCRC32C"] = str(encode_crc32c_b64(content))
1198
+ attrs["ChecksumCRC32C"] = encode_crc32c_b64(content).decode('utf8')
1196
1199
  self._conn.put_object(**attrs)
1197
1200
 
1198
1201
  @retry
cloudfiles/lib.py CHANGED
@@ -163,6 +163,8 @@ def crc32c(binary):
163
163
  Computes the crc32c of a binary string
164
164
  and returns it as an integer.
165
165
  """
166
+ if isinstance(binary, str):
167
+ binary = binary.encode('utf8')
166
168
  return crc32clib.crc32c(binary) # an integer
167
169
 
168
170
  def md5(binary, base=64):
cloudfiles/paths.py CHANGED
@@ -58,11 +58,14 @@ def update_aliases_from_file():
58
58
 
59
59
  def cloudpath_error(cloudpath):
60
60
  return yellow(f"""
61
- Cloud Path must conform to [FORMAT://]PROTOCOL://PATH
61
+ Cloud Path must conform to one of:
62
+ (a) [FORMAT://]PROTOCOL://PATH
63
+ (b) PROTOCOL://PATH|FORMAT:
62
64
  Examples:
63
65
  precomputed://gs://test_bucket/em
64
66
  gs://test_bucket/em
65
67
  graphene://https://example.com/image/em
68
+ gs://text_bucket/em/|zarr2:
66
69
 
67
70
  Supported Formats: None (precomputed), {", ".join(ALLOWED_FORMATS)}
68
71
  Supported Protocols: {", ".join(ALLOWED_PROTOCOLS)}
@@ -87,6 +90,9 @@ def mkregexp():
87
90
  CLOUDPATH_REGEXP = re.compile(mkregexp())
88
91
  BUCKET_RE = re.compile(r'^(/?[~\d\w_\.\-]+(?::\d+)?)(?:/|$)') # posix /what/a/great/path
89
92
 
93
+ # |neuroglancer-precomputed: or |zarr2: suffixes etc
94
+ TAIL_FORMAT_REGEXP = re.compile('\\|(?P<fmt>[\\w\\d-]+):$')
95
+
90
96
  def add_alias(alias:str, host:str):
91
97
  global ALIASES
92
98
  global ALLOWED_PROTOCOLS
@@ -165,6 +171,10 @@ for alias, host in OFFICIAL_ALIASES.items():
165
171
  def normalize(path):
166
172
 
167
173
  path = path.removesuffix(PRECOMPUTED_SUFFIX)
174
+ m = re.search(TAIL_FORMAT_REGEXP, path)
175
+ if m is not None:
176
+ path = re.sub(TAIL_FORMAT_REGEXP, "", path)
177
+ path = f"{m.group('fmt')}://{path}"
168
178
 
169
179
  fmt, proto, endpoint, cloudpath, alias = extract_format_protocol(
170
180
  path, allow_defaults=False
@@ -291,6 +301,13 @@ def pop_protocol(cloudpath):
291
301
  def extract_format_protocol(cloudpath:str, allow_defaults=True) -> tuple:
292
302
  error = UnsupportedProtocolError(cloudpath_error(cloudpath))
293
303
 
304
+ cloudpath = cloudpath.removesuffix(PRECOMPUTED_SUFFIX)
305
+
306
+ m = re.search(TAIL_FORMAT_REGEXP, cloudpath)
307
+ if m is not None:
308
+ cloudpath = re.sub(TAIL_FORMAT_REGEXP, "", cloudpath)
309
+ cloudpath = f"{m.group('fmt')}://{cloudpath}"
310
+
294
311
  alias, cloudpath = resolve_alias(cloudpath)
295
312
 
296
313
  m = re.match(CLOUDPATH_REGEXP, cloudpath)
@@ -299,7 +316,6 @@ def extract_format_protocol(cloudpath:str, allow_defaults=True) -> tuple:
299
316
 
300
317
  groups = m.groups()
301
318
  cloudpath = re.sub(CLOUDPATH_REGEXP, '', cloudpath, count=1)
302
- cloudpath = cloudpath.removesuffix(PRECOMPUTED_SUFFIX)
303
319
 
304
320
  fmt = m.group('fmt')
305
321
  if not fmt and allow_defaults:
@@ -1 +0,0 @@
1
- {"git_version": "894545a", "is_release": true}