nucliadb 6.2.1.post3087__py3-none-any.whl → 6.2.1.post3109__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.
@@ -0,0 +1,60 @@
1
+ # Copyright (C) 2021 Bosutech XXI S.L.
2
+ #
3
+ # nucliadb is offered under the AGPL v3.0 and as commercial software.
4
+ # For commercial licensing, contact us at info@nuclia.com.
5
+ #
6
+ # AGPL:
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Affero General Public License as
9
+ # published by the Free Software Foundation, either version 3 of the
10
+ # License, or (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Affero General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Affero General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ """Migration #30
22
+
23
+ We want to support labels with the same title anymore. Run a deduplication for
24
+ all labelsets
25
+
26
+ """
27
+
28
+ import logging
29
+
30
+ from nucliadb.common import datamanagers
31
+ from nucliadb.migrator.context import ExecutionContext
32
+
33
+ logger = logging.getLogger(__name__)
34
+
35
+
36
+ async def migrate(context: ExecutionContext) -> None: ...
37
+
38
+
39
+ async def migrate_kb(context: ExecutionContext, kbid: str) -> None:
40
+ async with datamanagers.with_rw_transaction() as txn:
41
+ kb_labels = await datamanagers.labels.get_labels(txn, kbid=kbid)
42
+ changed = False
43
+
44
+ for labelset in kb_labels.labelset.values():
45
+ current_labels = labelset.labels
46
+ labelset.ClearField("labels")
47
+ deduplicator = set()
48
+
49
+ for label in current_labels:
50
+ label_id = label.title.lower()
51
+ if label_id not in deduplicator:
52
+ deduplicator.add(label_id)
53
+ labelset.labels.append(label)
54
+
55
+ changed = changed or (len(labelset.labels) < len(current_labels))
56
+
57
+ if changed:
58
+ await datamanagers.labels.set_labels(txn, kbid=kbid, labels=kb_labels)
59
+
60
+ await txn.commit()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.2.1.post3087
3
+ Version: 6.2.1.post3109
4
4
  Home-page: https://docs.nuclia.dev/docs/management/nucliadb/intro
5
5
  Author: NucliaDB Community
6
6
  Author-email: nucliadb@nuclia.com
@@ -22,10 +22,10 @@ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3 :: Only
23
23
  Requires-Python: >=3.9, <4
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3087
26
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3087
27
- Requires-Dist: nucliadb-protos>=6.2.1.post3087
28
- Requires-Dist: nucliadb-models>=6.2.1.post3087
25
+ Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3109
26
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3109
27
+ Requires-Dist: nucliadb-protos>=6.2.1.post3109
28
+ Requires-Dist: nucliadb-models>=6.2.1.post3109
29
29
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
30
30
  Requires-Dist: nuclia-models>=0.24.2
31
31
  Requires-Dist: uvicorn
@@ -25,6 +25,7 @@ migrations/0026_fix_high_cardinality_content_types.py,sha256=BsbBkvZDzjRHQfoouZN
25
25
  migrations/0027_rollover_texts3.py,sha256=UQDaMOayVuqDisf82NDrPStoEVveHvdjkSmzbIcU9o4,2730
26
26
  migrations/0028_extracted_vectors_reference.py,sha256=49DHCIlBpjofU8cYVHTdWv0EBIlnPTWV2WCezf0rJUo,2392
27
27
  migrations/0029_backfill_field_status.py,sha256=QWF69n1da9lpRnbEpgbqPjSQ-Wfn6rMC7Enz6bBYGt4,5663
28
+ migrations/0030_label_deduplication.py,sha256=y14TxtCMi3-TBMz_eZoyyPDHNlZb29taJujlDuHumsA,2008
28
29
  migrations/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
29
30
  migrations/pg/0001_bootstrap.py,sha256=Fsqkeof50m7fKiJN05kmNEMwiKDlOrAgcAS5sLLkutA,1256
30
31
  migrations/pg/0002_catalog.py,sha256=Rsleecu351Ty19kYZgOpqX5G3MEAY8nMxCJrAeuS2Mw,1690
@@ -329,9 +330,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
329
330
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
330
331
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
331
332
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
332
- nucliadb-6.2.1.post3087.dist-info/METADATA,sha256=ATRQKTKtuCTKpwOtBrUBXJ-c5bmuSKKDlLl3jtV5f5o,4603
333
- nucliadb-6.2.1.post3087.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
334
- nucliadb-6.2.1.post3087.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
335
- nucliadb-6.2.1.post3087.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
336
- nucliadb-6.2.1.post3087.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
337
- nucliadb-6.2.1.post3087.dist-info/RECORD,,
333
+ nucliadb-6.2.1.post3109.dist-info/METADATA,sha256=sg4gBArQO8k3c5LBxpQELtuJVSsTFCrmxv1UbeqohIw,4603
334
+ nucliadb-6.2.1.post3109.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
335
+ nucliadb-6.2.1.post3109.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
336
+ nucliadb-6.2.1.post3109.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
337
+ nucliadb-6.2.1.post3109.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
338
+ nucliadb-6.2.1.post3109.dist-info/RECORD,,