nucliadb-utils 6.3.1.post3524__py3-none-any.whl → 6.3.1.post3526__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.

@@ -57,7 +57,7 @@ from nucliadb_utils.nuclia_usage.utils.kb_usage_report import KbUsageReportUtili
57
57
 
58
58
 
59
59
  class RequestContext:
60
- def __init__(self):
60
+ def __init__(self: "RequestContext"):
61
61
  self.audit_request: AuditRequest = AuditRequest()
62
62
  self.start_time: float = time.monotonic()
63
63
  self.path: str = ""
nucliadb_utils/nats.py CHANGED
@@ -47,8 +47,9 @@ def get_traced_jetstream(
47
47
 
48
48
  if tracer_provider is not None and jetstream is not None: # pragma: no cover
49
49
  logger.info(f"Configuring {service_name} jetstream with telemetry")
50
- jetstream = JetStreamContextTelemetry(jetstream, service_name, tracer_provider)
51
- return jetstream
50
+ return JetStreamContextTelemetry(jetstream, service_name, tracer_provider)
51
+ else:
52
+ return jetstream
52
53
 
53
54
 
54
55
  class MessageProgressUpdater:
nucliadb_utils/signals.py CHANGED
@@ -56,9 +56,9 @@ class Signal:
56
56
 
57
57
  async def dispatch(self, payload: Any):
58
58
  """Send signal to all registered callbacks by they priority order."""
59
- assert isinstance(
60
- payload, self.payload_model_type
61
- ), "Can't dispatch a signal with an invalid model"
59
+ assert isinstance(payload, self.payload_model_type), (
60
+ "Can't dispatch a signal with an invalid model"
61
+ )
62
62
 
63
63
  awaitables = [
64
64
  cb(payload=payload)
@@ -39,7 +39,7 @@ class InvalidOffset(Exception):
39
39
  class ResumableUploadGone(Exception):
40
40
  def __init__(self, text: str):
41
41
  self.text = text
42
- super().__init__("Resumable upload is no longer available " "Google: \n " f"{text}")
42
+ super().__init__(f"Resumable upload is no longer available Google: \n {text}")
43
43
 
44
44
 
45
45
  class CouldNotCopyNotFound(Exception):
@@ -371,7 +371,7 @@ class GCSStorageField(StorageField):
371
371
  await self.storage.delete_upload(self.field.old_uri, self.field.bucket_name)
372
372
  except GoogleCloudException as e:
373
373
  logger.warning(
374
- f"Could not delete existing google cloud file " f"with uri: {self.field.uri}: {e}"
374
+ f"Could not delete existing google cloud file with uri: {self.field.uri}: {e}"
375
375
  )
376
376
  if self.field.upload_uri != self.key:
377
377
  await self.move(self.field.upload_uri, self.key, self.field.bucket_name, self.bucket)
@@ -551,7 +551,7 @@ class GCSStorage(Storage):
551
551
  data = {"text": text}
552
552
  if resp.status == 404:
553
553
  logger.warning(
554
- f"Attempt to delete not found gcloud: {data}, " f"status: {resp.status}",
554
+ f"Attempt to delete not found gcloud: {data}, status: {resp.status}",
555
555
  exc_info=True,
556
556
  )
557
557
  elif resp.status not in (200, 204):
@@ -658,7 +658,7 @@ class GCSStorage(Storage):
658
658
  logger.error("Not implemented")
659
659
  elif resp.status == 404:
660
660
  logger.error(
661
- f"Attempt to delete not found gcloud: {data}, " f"status: {resp.status}",
661
+ f"Attempt to delete not found gcloud: {data}, status: {resp.status}",
662
662
  exc_info=True,
663
663
  )
664
664
  else:
@@ -392,7 +392,7 @@ class S3Storage(Storage):
392
392
  self._session = get_session()
393
393
  return self._session
394
394
 
395
- async def initialize(self):
395
+ async def initialize(self: "S3Storage") -> None:
396
396
  session = AioSession()
397
397
  self._s3aioclient: AioBaseClient = await self._exit_stack.enter_async_context(
398
398
  session.create_client("s3", **self.opts)
@@ -19,7 +19,7 @@
19
19
  #
20
20
  from contextlib import ExitStack
21
21
  from dataclasses import dataclass
22
- from typing import Any, Generator
22
+ from typing import Any, Generator, Iterator
23
23
  from unittest.mock import patch
24
24
 
25
25
  import pytest
@@ -112,7 +112,7 @@ def azurite() -> Generator[AzuriteFixture, None, None]:
112
112
 
113
113
 
114
114
  @pytest.fixture(scope="function")
115
- def azure_storage_settings(azurite: AzuriteFixture) -> dict[str, Any]:
115
+ def azure_storage_settings(azurite: AzuriteFixture) -> Iterator[dict[str, Any]]:
116
116
  settings = {
117
117
  "file_backend": FileBackendConfig.AZURE,
118
118
  "azure_account_url": azurite.account_url,
@@ -18,7 +18,7 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
20
  import os
21
- from typing import Any, Type
21
+ from typing import Any, Iterator, Type
22
22
  from unittest.mock import Mock
23
23
 
24
24
  import pytest
@@ -75,7 +75,7 @@ async def storage(request):
75
75
 
76
76
 
77
77
  @pytest.fixture(scope="function")
78
- def storage_settings(request, storage) -> dict[str, Any]:
78
+ def storage_settings(request, storage) -> Iterator[dict[str, Any]]:
79
79
  """Useful fixture that returns the settings used in the generic `storage`
80
80
  fixture.
81
81
 
@@ -20,7 +20,7 @@
20
20
  import re
21
21
  from concurrent.futures.thread import ThreadPoolExecutor
22
22
  from contextlib import ExitStack
23
- from typing import Any, Optional
23
+ from typing import Any, Iterator, Optional
24
24
  from unittest.mock import patch
25
25
 
26
26
  import docker # type: ignore # type: ignore
@@ -91,7 +91,7 @@ def running_in_mac_os() -> bool:
91
91
 
92
92
 
93
93
  @pytest.fixture(scope="function")
94
- def gcs_storage_settings(gcs) -> dict[str, Any]:
94
+ def gcs_storage_settings(gcs) -> Iterator[dict[str, Any]]:
95
95
  settings = {
96
96
  "file_backend": FileBackendConfig.GCS,
97
97
  "gcs_endpoint_url": gcs,
@@ -19,7 +19,7 @@
19
19
  #
20
20
  from contextlib import ExitStack
21
21
  from pathlib import Path
22
- from typing import Any
22
+ from typing import Any, Iterator
23
23
  from unittest.mock import patch
24
24
 
25
25
  import pytest
@@ -29,7 +29,7 @@ from nucliadb_utils.storages.local import LocalStorage
29
29
 
30
30
 
31
31
  @pytest.fixture(scope="function")
32
- def local_storage_settings(tmp_path: Path) -> dict[str, Any]:
32
+ def local_storage_settings(tmp_path: Path) -> Iterator[dict[str, Any]]:
33
33
  settings = {
34
34
  "file_backend": FileBackendConfig.LOCAL,
35
35
  "local_files": str((tmp_path / "blob").absolute()),
@@ -18,7 +18,7 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
20
  from contextlib import ExitStack
21
- from typing import Any
21
+ from typing import Any, AsyncIterator
22
22
  from unittest.mock import patch
23
23
 
24
24
  import pytest
@@ -62,7 +62,7 @@ def s3():
62
62
 
63
63
 
64
64
  @pytest.fixture(scope="function")
65
- async def s3_storage_settings(s3) -> dict[str, Any]:
65
+ async def s3_storage_settings(s3) -> AsyncIterator[dict[str, Any]]:
66
66
  settings = {
67
67
  "file_backend": FileBackendConfig.S3,
68
68
  "s3_endpoint": s3,
@@ -181,7 +181,7 @@ async def _create_storage(gcs_scopes: Optional[List[str]] = None) -> Storage:
181
181
  raise ConfigurationError("Invalid storage settings, please configure FILE_BACKEND")
182
182
 
183
183
 
184
- async def teardown_storage():
184
+ async def teardown_storage() -> None:
185
185
  storage: Optional[Storage] = get_utility(Utility.STORAGE)
186
186
  if storage is None:
187
187
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb_utils
3
- Version: 6.3.1.post3524
3
+ Version: 6.3.1.post3526
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.1.post3524
31
- Requires-Dist: nucliadb-telemetry>=6.3.1.post3524
30
+ Requires-Dist: nucliadb-protos>=6.3.1.post3526
31
+ Requires-Dist: nucliadb-telemetry>=6.3.1.post3526
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"
@@ -7,15 +7,15 @@ nucliadb_utils/exceptions.py,sha256=y_3wk77WLVUtdo-5FtbBsdSkCtK_DsJkdWb5BoPn3qo,
7
7
  nucliadb_utils/featureflagging.py,sha256=YxDiXzWuiDlHtqgeTVeyakmbAdzBePzJpgJv53ELbmI,2259
8
8
  nucliadb_utils/grpc.py,sha256=apu0uePnkGHCAT7GRQ9YZfRYyFj26kJ440i8jitbM3U,3314
9
9
  nucliadb_utils/helpers.py,sha256=nPw8yod3hP-pxq80VF8QC36s7ygSg0dBUdfI-LatvCs,1600
10
- nucliadb_utils/nats.py,sha256=99YJkK1QMfWDxKJK8u0acK0lLYb8yThalzulGETiT80,15266
10
+ nucliadb_utils/nats.py,sha256=-ehKk0u5ZhiJEyg67yV26YysBGEGp4TDSQKq3aydJn0,15275
11
11
  nucliadb_utils/partition.py,sha256=jBgy4Hu5Iwn4gjbPPcthSykwf-qNx-GcLAIwbzPd1d0,1157
12
12
  nucliadb_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  nucliadb_utils/run.py,sha256=Es0_Bu5Yc-LWczvwL6gzWqSwC85RjDCk-0oFQAJi9g4,1827
14
14
  nucliadb_utils/settings.py,sha256=RnGhEUvwv6faNqALiqDCivvzNOyyXVBflYh_37uNkow,8193
15
- nucliadb_utils/signals.py,sha256=JRNv2y9zLtBjOANBf7krGfDGfOc9qcoXZ6N1nKWS2FE,2674
15
+ nucliadb_utils/signals.py,sha256=lo_Mk12NIX5Au--3H3WObvDOXq_OMurql2qiC2TnAao,2676
16
16
  nucliadb_utils/store.py,sha256=kQ35HemE0v4_Qg6xVqNIJi8vSFAYQtwI3rDtMsNy62Y,890
17
17
  nucliadb_utils/transaction.py,sha256=YYnTpxCDs56lo0tS6ErABjk9WjDuieUc4f7r63Q_OP8,7864
18
- nucliadb_utils/utilities.py,sha256=usyqgkfinZeDoUSFpIugmKKJZpoi8wppFL_lAhhlkBI,15371
18
+ nucliadb_utils/utilities.py,sha256=Vc4zLpDf-FQh9bs0ZyAfGAjzlbbMTMWf3VWt2Ao5V3k,15379
19
19
  nucliadb_utils/aiopynecone/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
20
20
  nucliadb_utils/aiopynecone/client.py,sha256=MPyHnDXwhukJr7U3CJh7BpsekfSuOkyM4g5b9LLtzc8,22941
21
21
  nucliadb_utils/aiopynecone/exceptions.py,sha256=fUErx3ceKQK1MUbOnYcZhIzpNe8UVAptZE9JIRDLXDE,4000
@@ -23,7 +23,7 @@ nucliadb_utils/aiopynecone/models.py,sha256=XkNIZx4bxdbVo9zYVn8IRp70q4DWUMWN79yb
23
23
  nucliadb_utils/audit/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
24
24
  nucliadb_utils/audit/audit.py,sha256=VDUqcSToEoz5m7iG-4omjTlsBSEJGcp0_xl51idnU3Q,3384
25
25
  nucliadb_utils/audit/basic.py,sha256=pVf1oKp7T_oTDCyt8QbSsfC_uWjF66ooF6rqY-SWSrc,4032
26
- nucliadb_utils/audit/stream.py,sha256=AT4OuLTtQ3mID8Geasn6d7qRK8D7MIMUi7GemzU_7mk,16017
26
+ nucliadb_utils/audit/stream.py,sha256=SovPj5iTzXka2cg4NnwAZwnOYljhsT6ynhDC2OsRVPc,16035
27
27
  nucliadb_utils/cache/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
28
28
  nucliadb_utils/cache/exceptions.py,sha256=Zu-O_-0-yctOEgoDGI92gPzWfBMRrpiAyESA62ld6MA,975
29
29
  nucliadb_utils/cache/nats.py,sha256=-AjCfkFgKVdJUlGR0hT9JDSNkPVFg4S6w9eW-ZIcXPM,7037
@@ -40,24 +40,24 @@ nucliadb_utils/nuclia_usage/utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZ
40
40
  nucliadb_utils/nuclia_usage/utils/kb_usage_report.py,sha256=6lLuxCCPQVn3dOuZNL5ThPjl2yws-1TJ_7duhQSWkPU,3934
41
41
  nucliadb_utils/storages/__init__.py,sha256=5Qc8AUWiJv9_JbGCBpAn88AIJhwDlm0OPQpg2ZdRL4U,872
42
42
  nucliadb_utils/storages/azure.py,sha256=FK4c_v9AUAwagScm_F1uDmJeQQq7P4jZswiD2trwb4A,16394
43
- nucliadb_utils/storages/exceptions.py,sha256=_xUDbfr3XkmUc0xXYZu3DpG1C8TtfmEweRwj9mbRvMU,2507
44
- nucliadb_utils/storages/gcs.py,sha256=R35XQmf_M8Ba_eIuQumjAWSgU_lSouoTp-TTua-VgOM,28911
43
+ nucliadb_utils/storages/exceptions.py,sha256=GOPKH-F3dPTfHEkwGNfVkSfF70eWJJXjI83yccw9WpA,2501
44
+ nucliadb_utils/storages/gcs.py,sha256=5QODikIj26tfjz4KqhNgezPqqmqrG1yvUbarKAQ6sS0,28899
45
45
  nucliadb_utils/storages/local.py,sha256=JxlWNtu49JJ04dq6o7bBAqbpbeYpVyvvBM5jq1sGJ-4,11003
46
46
  nucliadb_utils/storages/nuclia.py,sha256=vEv94xAT7QM2g80S25QyrOw2pzvP2BAX-ADgZLtuCVc,2097
47
47
  nucliadb_utils/storages/object_store.py,sha256=HtKjIKhErSBvuqx1SuCOnL0SkiHqgfyekNMP8o2piZU,4492
48
- nucliadb_utils/storages/s3.py,sha256=pgakBqBLfDAFbdjwwX6u19QTv7gQYZ82Pjw67Yi6ob8,20895
48
+ nucliadb_utils/storages/s3.py,sha256=isw4v9L4tlwLklNotdF-l7mU4coshPzO5wj_tbuSNOc,20916
49
49
  nucliadb_utils/storages/settings.py,sha256=ugCPy1zxBOmA2KosT-4tsjpvP002kg5iQyi42yCGCJA,1285
50
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
54
- nucliadb_utils/tests/azure.py,sha256=Dg-Eb4KVScG-O6P9y-bVQZTAKTNUMQ0i-CKEd9IdrWw,4474
55
- nucliadb_utils/tests/fixtures.py,sha256=i0sqPqe5a5JlKGFdaIvOlHYkZ3pHZ2hTIgTsaIB3vSM,3472
56
- nucliadb_utils/tests/gcs.py,sha256=KW_DLet1WRlssSW55eI-IQ-0d94Jo2Oh7Di4xGv4JCc,4685
57
- nucliadb_utils/tests/local.py,sha256=fXIBasrvdaFJM-sw2wk1_oiFzBcm9O10iCyC-OiXwY8,1914
54
+ nucliadb_utils/tests/azure.py,sha256=NvMrPG6gfbpDE0m_aZgaa7eorbmA1r9rhAsAANhMlJk,4494
55
+ nucliadb_utils/tests/fixtures.py,sha256=uNiZ8qaOz2bSmSn-2ZMXxhQcHVh3tCyr5A-e0XaoRr8,3492
56
+ nucliadb_utils/tests/gcs.py,sha256=MBMzn_UHU5SU6iILuCsB5zU4umhNcaCw_MKrxZhwvOc,4705
57
+ nucliadb_utils/tests/local.py,sha256=cxIfPrKuqs5Ef0nbrVYQQAH2mwc4E0iD9bC2sWegS-c,1934
58
58
  nucliadb_utils/tests/nats.py,sha256=RWHjwqq5esuO7OFbP24yYX1cXnpPLcWJwDUdmwCpH28,1897
59
- nucliadb_utils/tests/s3.py,sha256=pl-RJFjA4MH6iXkqhsh5g8gDuEhrYu1nPZ-laxlrMlE,3704
60
- nucliadb_utils-6.3.1.post3524.dist-info/METADATA,sha256=tMP8Wx4jEKAM8zESbKBv1QQKqJe7jvbxoW0md9DHIDc,2209
61
- nucliadb_utils-6.3.1.post3524.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
62
- nucliadb_utils-6.3.1.post3524.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
63
- nucliadb_utils-6.3.1.post3524.dist-info/RECORD,,
59
+ nucliadb_utils/tests/s3.py,sha256=DACUh3HvgH3BchKFZ9R7RFUzsrg3v9A-cxTcXx4nmvA,3734
60
+ nucliadb_utils-6.3.1.post3526.dist-info/METADATA,sha256=aZS3f5jsY6xY837mfcDJxkqUsUksTbzTzpld0e5IRdg,2209
61
+ nucliadb_utils-6.3.1.post3526.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
62
+ nucliadb_utils-6.3.1.post3526.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
63
+ nucliadb_utils-6.3.1.post3526.dist-info/RECORD,,