cloud-files 5.1.3__py3-none-any.whl → 5.2.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.2.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=m-yqw8UZDyqSh5UmAbhxAwiHfghm8ZlM-PYhMIFRvBg,11970
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.2.0.dist-info/AUTHORS,sha256=BFVmobgAhaVFI5fqbuqAY5XmBQxe09ZZAsAOTy87hKQ,318
20
+ cloud_files-5.2.0.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
+ cloud_files-5.2.0.dist-info/METADATA,sha256=A4pHEujfPkvc7EPJXzLkD6qTmHHjTGa6j-gRdGKpzOc,27047
22
+ cloud_files-5.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
+ cloud_files-5.2.0.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
+ cloud_files-5.2.0.dist-info/pbr.json,sha256=uVr_LHVHsu5P73ohQ8kBMAaEXy0hIXNBvQ1egxi8D0I,46
25
+ cloud_files-5.2.0.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
+ cloud_files-5.2.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "bee40ef", "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
@@ -291,6 +297,13 @@ def pop_protocol(cloudpath):
291
297
  def extract_format_protocol(cloudpath:str, allow_defaults=True) -> tuple:
292
298
  error = UnsupportedProtocolError(cloudpath_error(cloudpath))
293
299
 
300
+ cloudpath = cloudpath.removesuffix(PRECOMPUTED_SUFFIX)
301
+
302
+ m = re.search(TAIL_FORMAT_REGEXP, cloudpath)
303
+ if m is not None:
304
+ cloudpath = re.sub(TAIL_FORMAT_REGEXP, "", cloudpath)
305
+ cloudpath = f"{m.group('fmt')}://{cloudpath}"
306
+
294
307
  alias, cloudpath = resolve_alias(cloudpath)
295
308
 
296
309
  m = re.match(CLOUDPATH_REGEXP, cloudpath)
@@ -299,7 +312,6 @@ def extract_format_protocol(cloudpath:str, allow_defaults=True) -> tuple:
299
312
 
300
313
  groups = m.groups()
301
314
  cloudpath = re.sub(CLOUDPATH_REGEXP, '', cloudpath, count=1)
302
- cloudpath = cloudpath.removesuffix(PRECOMPUTED_SUFFIX)
303
315
 
304
316
  fmt = m.group('fmt')
305
317
  if not fmt and allow_defaults:
@@ -1 +0,0 @@
1
- {"git_version": "894545a", "is_release": true}