nucliadb-utils 6.3.0.post3402__py3-none-any.whl → 6.3.0.post3415__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.

Potentially problematic release.


This version of nucliadb-utils might be problematic. Click here for more details.

@@ -441,23 +441,9 @@ class Storage(abc.ABC, metaclass=abc.ABCMeta):
441
441
  return result
442
442
 
443
443
  async def downloadbytescf(self, cf: CloudFile) -> BytesIO: # pragma: no cover
444
- # this is covered by other tests
445
444
  result = BytesIO()
446
- if cf.source == self.source:
447
- async for data in self.download(cf.bucket_name, cf.uri):
448
- if data is not None:
449
- result.write(data)
450
- elif cf.source == CloudFile.FLAPS:
451
- flaps_storage = await get_nuclia_storage()
452
- async for data in flaps_storage.download(cf):
453
- if data is not None:
454
- result.write(data)
455
- elif cf.source == CloudFile.LOCAL:
456
- local_storage = get_local_storage()
457
- async for data in local_storage.download(cf.bucket_name, cf.uri):
458
- if data is not None:
459
- result.write(data)
460
-
445
+ async for data in self.downloadbytescf_iterator(cf):
446
+ result.write(data)
461
447
  result.seek(0)
462
448
  return result
463
449
 
@@ -499,6 +485,16 @@ class Storage(abc.ABC, metaclass=abc.ABCMeta):
499
485
  @abc.abstractmethod
500
486
  def get_bucket_name(self, kbid: str) -> str: ...
501
487
 
488
+ def get_bucket_name_from_cf(self, cf: CloudFile) -> str:
489
+ """
490
+ We need this because some CloudFile objects have the `bucket_name` attribute pointing to old/incorrect bucket names.
491
+ Doing a migration is not feasible, so we need to dynamically get the bucket name from the uri.
492
+ We assume that all uris have the following prefix:
493
+ kbs/{kbid}/...
494
+ """
495
+ kbid = cf.uri.split("/")[1]
496
+ return self.get_bucket_name(kbid)
497
+
502
498
  @abc.abstractmethod
503
499
  async def initialize(self) -> None: ...
504
500
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb_utils
3
- Version: 6.3.0.post3402
3
+ Version: 6.3.0.post3415
4
4
  Summary: NucliaDB util library
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -27,8 +27,8 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
27
27
  Requires-Dist: PyNaCl
28
28
  Requires-Dist: pyjwt>=2.4.0
29
29
  Requires-Dist: mrflagly>=0.2.9
30
- Requires-Dist: nucliadb-protos>=6.3.0.post3402
31
- Requires-Dist: nucliadb-telemetry>=6.3.0.post3402
30
+ Requires-Dist: nucliadb-protos>=6.3.0.post3415
31
+ Requires-Dist: nucliadb-telemetry>=6.3.0.post3415
32
32
  Provides-Extra: cache
33
33
  Requires-Dist: redis>=4.3.4; extra == "cache"
34
34
  Requires-Dist: orjson>=3.6.7; extra == "cache"
@@ -47,7 +47,7 @@ nucliadb_utils/storages/nuclia.py,sha256=vEv94xAT7QM2g80S25QyrOw2pzvP2BAX-ADgZLt
47
47
  nucliadb_utils/storages/object_store.py,sha256=HtKjIKhErSBvuqx1SuCOnL0SkiHqgfyekNMP8o2piZU,4492
48
48
  nucliadb_utils/storages/s3.py,sha256=pgakBqBLfDAFbdjwwX6u19QTv7gQYZ82Pjw67Yi6ob8,20895
49
49
  nucliadb_utils/storages/settings.py,sha256=ugCPy1zxBOmA2KosT-4tsjpvP002kg5iQyi42yCGCJA,1285
50
- nucliadb_utils/storages/storage.py,sha256=15AqJKnFbDVrPAStJNJtRmqc0jpANvDUS2R83Hifuxk,21266
50
+ nucliadb_utils/storages/storage.py,sha256=1LSaZKQ4xSoBP85OVATh7zBZdBQ369Wl1uYBymZPfPw,21135
51
51
  nucliadb_utils/storages/utils.py,sha256=8g2rIwJeYIumQLOB47Yw1rx3twlhRB_cJxer65QfZmk,1479
52
52
  nucliadb_utils/tests/__init__.py,sha256=Oo9CAE7B0eW5VHn8sHd6o30SQzOWUhktLPRXdlDOleA,1456
53
53
  nucliadb_utils/tests/asyncbenchmark.py,sha256=vrX_x9ifCXi18PfNShc23w9x_VUiB_Ph-2nuolh9z3Q,10707
@@ -57,7 +57,7 @@ nucliadb_utils/tests/gcs.py,sha256=KW_DLet1WRlssSW55eI-IQ-0d94Jo2Oh7Di4xGv4JCc,4
57
57
  nucliadb_utils/tests/local.py,sha256=fXIBasrvdaFJM-sw2wk1_oiFzBcm9O10iCyC-OiXwY8,1914
58
58
  nucliadb_utils/tests/nats.py,sha256=RWHjwqq5esuO7OFbP24yYX1cXnpPLcWJwDUdmwCpH28,1897
59
59
  nucliadb_utils/tests/s3.py,sha256=pl-RJFjA4MH6iXkqhsh5g8gDuEhrYu1nPZ-laxlrMlE,3704
60
- nucliadb_utils-6.3.0.post3402.dist-info/METADATA,sha256=xXMgXcXJ7FeNzxl2_j49Lny3N4F1xYOvtk8Sl5rlJ_g,2209
61
- nucliadb_utils-6.3.0.post3402.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
62
- nucliadb_utils-6.3.0.post3402.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
63
- nucliadb_utils-6.3.0.post3402.dist-info/RECORD,,
60
+ nucliadb_utils-6.3.0.post3415.dist-info/METADATA,sha256=_90TfyuJMzVekA2bHqXUB_RmBzCO7f8m6D7NpL95e_E,2209
61
+ nucliadb_utils-6.3.0.post3415.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
62
+ nucliadb_utils-6.3.0.post3415.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
63
+ nucliadb_utils-6.3.0.post3415.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5