cloud-files 5.1.0__py3-none-any.whl → 5.1.2__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.0
3
+ Version: 5.1.2
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
@@ -1,25 +1,26 @@
1
1
  cloudfiles/__init__.py,sha256=pLB4CcV2l3Jgv_ni1520Np1pfzFj8Cpr87vNxFT3rNI,493
2
2
  cloudfiles/cloudfiles.py,sha256=K8rKzrzDzbi1HjGoPMsXSMFzTbe_KLfDIyk4tRjoGEI,51070
3
- cloudfiles/compression.py,sha256=pqYdpu5vfFv-094BpfZ2pgRjVu7ESM9pAZC09P6E8bY,6150
3
+ cloudfiles/compression.py,sha256=09FM4fZcNkSy5zg6GjBzanAMtuvV5kTosc6gvloiSiU,6255
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=jAILgy6v67L0tV4QXe03wm6fzb2nJ3PJQod8IPE_c7k,43601
7
+ cloudfiles/interfaces.py,sha256=8Gez-1q1Ulb6p_qSfydwAKXvJybVi-QS0yfkvSnm44I,43862
8
8
  cloudfiles/lib.py,sha256=9YFGMCy0mi23baqtsr-f5Gd1ewAGvD7x3UVNt772Z9E,5317
9
9
  cloudfiles/paths.py,sha256=4B3qWjR2TP8wAYK4NLw-iy2KUn3VNspKp6_Vy4j3I8A,11592
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
13
+ cloudfiles/test.py,sha256=jktBhzKLU448QPs5H7QVnTvpYMo4lBBWG1aE7-uzVGQ,678
13
14
  cloudfiles/threaded_queue.py,sha256=Nl4vfXhQ6nDLF8PZpSSBpww0M2zWtcd4DLs3W3BArBw,7082
14
15
  cloudfiles/typing.py,sha256=f3ZYkNfN9poxhGu5j-P0KCxjCCqSn9HAg5KiIPkjnCg,416
15
16
  cloudfiles_cli/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
16
17
  cloudfiles_cli/__init__.py,sha256=Wftt3R3F21QsHtWqx49ODuqT9zcSr0em7wk48kcH0WM,29
17
18
  cloudfiles_cli/cloudfiles_cli.py,sha256=_2Amjp3vsdq7vQgF2utD6BJqjOPKXOTjrJyehnlojpQ,34893
18
- cloud_files-5.1.0.dist-info/AUTHORS,sha256=BFVmobgAhaVFI5fqbuqAY5XmBQxe09ZZAsAOTy87hKQ,318
19
- cloud_files-5.1.0.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
20
- cloud_files-5.1.0.dist-info/METADATA,sha256=J8ZvZo3w1SJDhpuvyy5Qz8yswZElEsFMzMfzN3iqnvY,27047
21
- cloud_files-5.1.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
22
- cloud_files-5.1.0.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
23
- cloud_files-5.1.0.dist-info/pbr.json,sha256=xEKcf5cQdkKoIlJkxO7RUsjjZQPsSGYZpQUsAew5Ve8,46
24
- cloud_files-5.1.0.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
25
- cloud_files-5.1.0.dist-info/RECORD,,
19
+ cloud_files-5.1.2.dist-info/AUTHORS,sha256=BFVmobgAhaVFI5fqbuqAY5XmBQxe09ZZAsAOTy87hKQ,318
20
+ cloud_files-5.1.2.dist-info/LICENSE,sha256=Jna4xYE8CCQmaxjr5Fs-wmUBnIQJ1DGcNn9MMjbkprk,1538
21
+ cloud_files-5.1.2.dist-info/METADATA,sha256=znVdwBEwK11C2z5OVF87VHUAKXzz046vHDV4aX3kK4M,27047
22
+ cloud_files-5.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
+ cloud_files-5.1.2.dist-info/entry_points.txt,sha256=xlirb1FVhn1mbcv4IoyMEGumDqKOA4VMVd3drsRQxIg,51
24
+ cloud_files-5.1.2.dist-info/pbr.json,sha256=3bJhiZoxbezXPczAXpnP1R4rkDWW-NnjoFBNZJvHEbI,46
25
+ cloud_files-5.1.2.dist-info/top_level.txt,sha256=xPyrST3okJbsmdCF5IC2gYAVxg_aD5AYVTnNo8UuoZU,26
26
+ cloud_files-5.1.2.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "02bf227", "is_release": true}
cloudfiles/compression.py CHANGED
@@ -171,7 +171,7 @@ def gzip_compress(content, compresslevel=None):
171
171
  compresslevel = 9
172
172
 
173
173
  if deflate:
174
- return deflate.gzip_compress(content, compresslevel)
174
+ return bytes(deflate.gzip_compress(content, compresslevel))
175
175
 
176
176
  stringio = BytesIO()
177
177
  gzip_obj = gzip.GzipFile(mode='wb', fileobj=stringio, compresslevel=compresslevel)
@@ -190,7 +190,12 @@ def gunzip(content):
190
190
  raise DecompressionError('File contains zero bytes.')
191
191
 
192
192
  gzip_magic_numbers = [ 0x1f, 0x8b ]
193
- first_two_bytes = [ byte for byte in bytearray(content)[:2] ]
193
+
194
+ if isinstance(content, (bytes, bytearray)):
195
+ first_two_bytes = list(content[:2])
196
+ else:
197
+ first_two_bytes = [ byte for byte in bytearray(content)[:2] ]
198
+
194
199
  if first_two_bytes != gzip_magic_numbers:
195
200
  raise DecompressionError('File is not in gzip format. Magic numbers {}, {} did not match {}, {}.'.format(
196
201
  hex(first_two_bytes[0]), hex(first_two_bytes[1]), hex(gzip_magic_numbers[0]), hex(gzip_magic_numbers[1])
cloudfiles/interfaces.py CHANGED
@@ -707,6 +707,7 @@ class GoogleCloudStorageInterface(StorageInterface):
707
707
  key = self.get_path_to_file(src)
708
708
  blob = self._bucket.blob(key)
709
709
  try:
710
+ mkdir(os.path.dirname(dest))
710
711
  blob.download_to_filename(
711
712
  filename=dest,
712
713
  raw_download=True,
@@ -834,6 +835,14 @@ class GoogleCloudStorageInterface(StorageInterface):
834
835
  elif flat and '/' not in blob.name.removeprefix(path):
835
836
  yield filename
836
837
 
838
+ # When there are no regular items at this level
839
+ # we need to still print the directories.
840
+ if first and blobs.prefixes:
841
+ yield from (
842
+ item.removeprefix(path)
843
+ for item in blobs.prefixes
844
+ )
845
+
837
846
  def release_connection(self):
838
847
  global GC_POOL
839
848
  with GCS_BUCKET_POOL_LOCK:
cloudfiles/test.py ADDED
@@ -0,0 +1,28 @@
1
+ import igneous.task_creation as tc
2
+ import os
3
+ from taskqueue import totask
4
+ import igneous.tasks
5
+
6
+
7
+ def process_task(msg):
8
+ task = totask(msg)
9
+ task.execute()
10
+ return None
11
+
12
+ def submit_tasks():
13
+ paths = [
14
+ "gs://ng_scratch_ranl_7/make_cv_happy/seg/20250403024338",]
15
+ all_tasks = []
16
+ for img_path in paths:
17
+ mip = 0
18
+ num_mips = 2
19
+ tasks = tc.create_downsampling_tasks(img_path,
20
+ fill_missing=False,
21
+ delete_black_uploads=True,
22
+ mip=mip, num_mips=num_mips)
23
+ all_tasks += list(tasks)
24
+ return all_tasks
25
+
26
+ if __name__ == "__main__":
27
+ tasks = submit_tasks()
28
+ process_task(tasks[0])
@@ -1 +0,0 @@
1
- {"git_version": "4678ea6", "is_release": true}