nucliadb-models 6.4.0.post4200__py3-none-any.whl → 6.4.0.post4210__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.
- nucliadb_models/filters.py +28 -22
- nucliadb_models/graph/requests.py +5 -5
- {nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/METADATA +1 -1
- {nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/RECORD +6 -6
- {nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/WHEEL +0 -0
- {nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/top_level.txt +0 -0
nucliadb_models/filters.py
CHANGED
@@ -22,7 +22,7 @@ from enum import Enum
|
|
22
22
|
from typing import Any, Generic, Literal, Optional, TypeVar, Union
|
23
23
|
|
24
24
|
import pydantic
|
25
|
-
from pydantic import BaseModel, Discriminator, Tag, model_validator
|
25
|
+
from pydantic import AliasChoices, BaseModel, Discriminator, Tag, model_validator
|
26
26
|
from typing_extensions import Annotated, Self
|
27
27
|
|
28
28
|
from .common import FieldTypeName, Paragraph
|
@@ -35,7 +35,9 @@ F = TypeVar("F", bound=BaseModel)
|
|
35
35
|
class And(BaseModel, Generic[F], extra="forbid"):
|
36
36
|
"""AND of other expressions"""
|
37
37
|
|
38
|
-
operands: list[F] = pydantic.Field(
|
38
|
+
operands: list[F] = pydantic.Field(
|
39
|
+
serialization_alias="and", validation_alias=AliasChoices("operands", "and"), min_length=1
|
40
|
+
)
|
39
41
|
|
40
42
|
@pydantic.model_serializer
|
41
43
|
def serialize_boolean(self) -> dict[str, Any]:
|
@@ -45,7 +47,9 @@ class And(BaseModel, Generic[F], extra="forbid"):
|
|
45
47
|
class Or(BaseModel, Generic[F], extra="forbid"):
|
46
48
|
"""OR of other expressions"""
|
47
49
|
|
48
|
-
operands: list[F] = pydantic.Field(
|
50
|
+
operands: list[F] = pydantic.Field(
|
51
|
+
serialization_alias="or", validation_alias=AliasChoices("operands", "or"), min_length=1
|
52
|
+
)
|
49
53
|
|
50
54
|
@pydantic.model_serializer
|
51
55
|
def serialize_boolean(self) -> dict[str, Any]:
|
@@ -55,7 +59,9 @@ class Or(BaseModel, Generic[F], extra="forbid"):
|
|
55
59
|
class Not(BaseModel, Generic[F], extra="forbid"):
|
56
60
|
"""NOT another expression"""
|
57
61
|
|
58
|
-
operand: F = pydantic.Field(
|
62
|
+
operand: F = pydantic.Field(
|
63
|
+
serialization_alias="not", validation_alias=AliasChoices("operand", "not")
|
64
|
+
)
|
59
65
|
|
60
66
|
@pydantic.model_serializer
|
61
67
|
def serialize_boolean(self) -> dict[str, Any]:
|
@@ -65,7 +71,7 @@ class Not(BaseModel, Generic[F], extra="forbid"):
|
|
65
71
|
class Resource(BaseModel, extra="forbid"):
|
66
72
|
"""Matches all fields of a resource given its id or slug"""
|
67
73
|
|
68
|
-
prop: Literal["resource"]
|
74
|
+
prop: Literal["resource"] = "resource"
|
69
75
|
id: Optional[str] = pydantic.Field(default=None, description="ID of the resource to match")
|
70
76
|
slug: Optional[str] = pydantic.Field(default=None, description="Slug of the resource to match")
|
71
77
|
|
@@ -81,7 +87,7 @@ class Resource(BaseModel, extra="forbid"):
|
|
81
87
|
class Field(BaseModel, extra="forbid"):
|
82
88
|
"""Matches a field or set of fields"""
|
83
89
|
|
84
|
-
prop: Literal["field"]
|
90
|
+
prop: Literal["field"] = "field"
|
85
91
|
type: FieldTypeName = pydantic.Field(description="Type of the field to match, ")
|
86
92
|
name: Optional[str] = pydantic.Field(
|
87
93
|
default=None,
|
@@ -92,14 +98,14 @@ class Field(BaseModel, extra="forbid"):
|
|
92
98
|
class Keyword(BaseModel, extra="forbid"):
|
93
99
|
"""Matches all fields that contain a keyword"""
|
94
100
|
|
95
|
-
prop: Literal["keyword"]
|
101
|
+
prop: Literal["keyword"] = "keyword"
|
96
102
|
word: str = pydantic.Field(description="Keyword to find")
|
97
103
|
|
98
104
|
|
99
105
|
class DateCreated(BaseModel, extra="forbid"):
|
100
106
|
"""Matches all fields created in a date range"""
|
101
107
|
|
102
|
-
prop: Literal["created"]
|
108
|
+
prop: Literal["created"] = "created"
|
103
109
|
since: Optional[DateTime] = pydantic.Field(
|
104
110
|
default=None, description="Start of the date range. Leave blank for unbounded"
|
105
111
|
)
|
@@ -117,7 +123,7 @@ class DateCreated(BaseModel, extra="forbid"):
|
|
117
123
|
class DateModified(BaseModel, extra="forbid"):
|
118
124
|
"""Matches all fields modified in a date range"""
|
119
125
|
|
120
|
-
prop: Literal["modified"]
|
126
|
+
prop: Literal["modified"] = "modified"
|
121
127
|
since: Optional[DateTime] = pydantic.Field(
|
122
128
|
default=None, description="Start of the date range. Leave blank for unbounded"
|
123
129
|
)
|
@@ -135,7 +141,7 @@ class DateModified(BaseModel, extra="forbid"):
|
|
135
141
|
class Label(BaseModel, extra="forbid"):
|
136
142
|
"""Matches fields/paragraphs with a label (or labelset)"""
|
137
143
|
|
138
|
-
prop: Literal["label"]
|
144
|
+
prop: Literal["label"] = "label"
|
139
145
|
labelset: str = pydantic.Field(description="The labelset to match")
|
140
146
|
label: Optional[str] = pydantic.Field(
|
141
147
|
default=None,
|
@@ -149,7 +155,7 @@ class ResourceMimetype(BaseModel, extra="forbid"):
|
|
149
155
|
The mimetype of a resource can be assigned independently of the mimetype of its fields.
|
150
156
|
In resources with multiple fields, you may prefer to use `field_mimetype`"""
|
151
157
|
|
152
|
-
prop: Literal["resource_mimetype"]
|
158
|
+
prop: Literal["resource_mimetype"] = "resource_mimetype"
|
153
159
|
type: str = pydantic.Field(
|
154
160
|
description="Type of the mimetype to match. e.g: In image/jpeg, type is image"
|
155
161
|
)
|
@@ -165,7 +171,7 @@ class ResourceMimetype(BaseModel, extra="forbid"):
|
|
165
171
|
class FieldMimetype(BaseModel, extra="forbid"):
|
166
172
|
"""Matches fields with a mimetype"""
|
167
173
|
|
168
|
-
prop: Literal["field_mimetype"]
|
174
|
+
prop: Literal["field_mimetype"] = "field_mimetype"
|
169
175
|
type: str = pydantic.Field(
|
170
176
|
description="Type of the mimetype to match. e.g: In image/jpeg, type is image"
|
171
177
|
)
|
@@ -181,7 +187,7 @@ class FieldMimetype(BaseModel, extra="forbid"):
|
|
181
187
|
class Entity(BaseModel, extra="forbid"):
|
182
188
|
"""Matches fields that contains a detected entity"""
|
183
189
|
|
184
|
-
prop: Literal["entity"]
|
190
|
+
prop: Literal["entity"] = "entity"
|
185
191
|
subtype: str = pydantic.Field(description="Type of the entity. e.g: PERSON")
|
186
192
|
value: Optional[str] = pydantic.Field(
|
187
193
|
default=None,
|
@@ -192,7 +198,7 @@ class Entity(BaseModel, extra="forbid"):
|
|
192
198
|
class Language(BaseModel, extra="forbid"):
|
193
199
|
"""Matches the language of the field"""
|
194
200
|
|
195
|
-
prop: Literal["language"]
|
201
|
+
prop: Literal["language"] = "language"
|
196
202
|
only_primary: bool = pydantic.Field(
|
197
203
|
default=False,
|
198
204
|
description="Match only the primary language of the document. By default, matches any language that appears in the document",
|
@@ -203,14 +209,14 @@ class Language(BaseModel, extra="forbid"):
|
|
203
209
|
class OriginTag(BaseModel, extra="forbid"):
|
204
210
|
"""Matches all fields with a given origin tag"""
|
205
211
|
|
206
|
-
prop: Literal["origin_tag"]
|
212
|
+
prop: Literal["origin_tag"] = "origin_tag"
|
207
213
|
tag: str = pydantic.Field(description="The tag to match")
|
208
214
|
|
209
215
|
|
210
216
|
class OriginMetadata(BaseModel, extra="forbid"):
|
211
217
|
"""Matches metadata from the origin"""
|
212
218
|
|
213
|
-
prop: Literal["origin_metadata"]
|
219
|
+
prop: Literal["origin_metadata"] = "origin_metadata"
|
214
220
|
field: str = pydantic.Field(description="Metadata field")
|
215
221
|
value: Optional[str] = pydantic.Field(
|
216
222
|
default=None,
|
@@ -221,7 +227,7 @@ class OriginMetadata(BaseModel, extra="forbid"):
|
|
221
227
|
class OriginPath(BaseModel, extra="forbid"):
|
222
228
|
"""Matches the origin path"""
|
223
229
|
|
224
|
-
prop: Literal["origin_path"]
|
230
|
+
prop: Literal["origin_path"] = "origin_path"
|
225
231
|
prefix: Optional[str] = pydantic.Field(
|
226
232
|
default=None,
|
227
233
|
description=(
|
@@ -234,21 +240,21 @@ class OriginPath(BaseModel, extra="forbid"):
|
|
234
240
|
class OriginSource(BaseModel, extra="forbid"):
|
235
241
|
"""Matches the origin source id"""
|
236
242
|
|
237
|
-
prop: Literal["origin_source"]
|
243
|
+
prop: Literal["origin_source"] = "origin_source"
|
238
244
|
id: Optional[str] = pydantic.Field(default=None, description=("Source ID"))
|
239
245
|
|
240
246
|
|
241
247
|
class OriginCollaborator(BaseModel, extra="forbid"):
|
242
248
|
"""Matches the origin collaborators"""
|
243
249
|
|
244
|
-
prop: Literal["origin_collaborator"]
|
250
|
+
prop: Literal["origin_collaborator"] = "origin_collaborator"
|
245
251
|
collaborator: str = pydantic.Field(description=("Collaborator"))
|
246
252
|
|
247
253
|
|
248
254
|
class Generated(BaseModel, extra="forbid"):
|
249
255
|
"""Matches if the field was generated by the given source"""
|
250
256
|
|
251
|
-
prop: Literal["generated"]
|
257
|
+
prop: Literal["generated"] = "generated"
|
252
258
|
by: Literal["data-augmentation"] = pydantic.Field(
|
253
259
|
description="Generator for this field. Currently, only data-augmentation is supported"
|
254
260
|
)
|
@@ -260,14 +266,14 @@ class Generated(BaseModel, extra="forbid"):
|
|
260
266
|
class Kind(BaseModel, extra="forbid"):
|
261
267
|
"""Matches paragraphs of a certain kind"""
|
262
268
|
|
263
|
-
prop: Literal["kind"]
|
269
|
+
prop: Literal["kind"] = "kind"
|
264
270
|
kind: Paragraph.TypeParagraph = pydantic.Field(description="The kind of paragraph to match")
|
265
271
|
|
266
272
|
|
267
273
|
class Status(BaseModel, extra="forbid"):
|
268
274
|
"""Matches resource in a certain processing status"""
|
269
275
|
|
270
|
-
prop: Literal["status"]
|
276
|
+
prop: Literal["status"] = "status"
|
271
277
|
status: ResourceProcessingStatus = pydantic.Field(description="The status of the resource")
|
272
278
|
|
273
279
|
|
@@ -63,19 +63,19 @@ class GraphRelation(BaseModel, extra="forbid"):
|
|
63
63
|
|
64
64
|
|
65
65
|
class AnyNode(GraphNode):
|
66
|
-
prop: Literal["node"]
|
66
|
+
prop: Literal["node"] = "node"
|
67
67
|
|
68
68
|
|
69
69
|
class SourceNode(GraphNode):
|
70
|
-
prop: Literal["source_node"]
|
70
|
+
prop: Literal["source_node"] = "source_node"
|
71
71
|
|
72
72
|
|
73
73
|
class DestinationNode(GraphNode):
|
74
|
-
prop: Literal["destination_node"]
|
74
|
+
prop: Literal["destination_node"] = "destination_node"
|
75
75
|
|
76
76
|
|
77
77
|
class Relation(GraphRelation):
|
78
|
-
prop: Literal["relation"]
|
78
|
+
prop: Literal["relation"] = "relation"
|
79
79
|
|
80
80
|
|
81
81
|
class GraphPath(BaseModel, extra="forbid"):
|
@@ -95,7 +95,7 @@ class Generator(str, Enum):
|
|
95
95
|
class Generated(BaseModel, extra="forbid"):
|
96
96
|
"""Matches if the relation was generated by the given source"""
|
97
97
|
|
98
|
-
prop: Literal["generated"]
|
98
|
+
prop: Literal["generated"] = "generated"
|
99
99
|
by: Generator = Field(description="Generator for this field.")
|
100
100
|
da_task: Optional["str"] = Field(
|
101
101
|
default=None, description="Matches relations generated by an specific DA task, given its prefix"
|
{nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/RECORD
RENAMED
@@ -8,7 +8,7 @@ nucliadb_models/export_import.py,sha256=A1KTjwQCRtyVAWcgabXsdltI78rauXBmZX1ie6Rx
|
|
8
8
|
nucliadb_models/external_index_providers.py,sha256=aVyj-P4kVqfqPjF13E_lUM0FZsq8-DTbIsh-kHOgt2s,1787
|
9
9
|
nucliadb_models/extracted.py,sha256=CBeC0hUphXq1T79K7Cpohuyg7f1pqTB4WGErb0HGgRs,6497
|
10
10
|
nucliadb_models/file.py,sha256=FKnaYUZPjxCEDUpbyDTudnHHKeSuQLfBnRR2FL6tL2s,1992
|
11
|
-
nucliadb_models/filters.py,sha256=
|
11
|
+
nucliadb_models/filters.py,sha256=fVbQLwzidnugeYBSAvc_NN32UwcGg44y2DMsuBFnvoM,14182
|
12
12
|
nucliadb_models/labels.py,sha256=OUlX-apmFkibEN9bWThRJlbCD84hzJdddN1YYUV2Y3w,4201
|
13
13
|
nucliadb_models/link.py,sha256=x6YainEQ9gx6X1KF8oelA-RTaqjOesoWJNYENihDfgo,2262
|
14
14
|
nucliadb_models/metadata.py,sha256=ppwU__5IWHvBNDUT5EGLZxgpSBTwuA-rEpY-8Ef-Lwo,8600
|
@@ -27,12 +27,12 @@ nucliadb_models/vectorsets.py,sha256=avxwO9JPX2k5sCniuNhh2MSsP7aRNvf1eB1-h3-Ju1o
|
|
27
27
|
nucliadb_models/writer.py,sha256=OLtCGmicpVf56pXi2_myTAvStpnaBKKOVNtZzHkKKtw,8472
|
28
28
|
nucliadb_models/agents/ingestion.py,sha256=mV7gV6VpYg4VNpc59K3275TMUJZbUzeUnp3SZzO5uxY,3137
|
29
29
|
nucliadb_models/graph/__init__.py,sha256=eu_1UK7GlBQRg5IRUqJkxVMcBxkXeqX4SZL6fuvwjDg,897
|
30
|
-
nucliadb_models/graph/requests.py,sha256=
|
30
|
+
nucliadb_models/graph/requests.py,sha256=k77EeuZOPaBrPdbc46le4FxpJSSNG_WNhE3YtL3cncw,8384
|
31
31
|
nucliadb_models/graph/responses.py,sha256=3aimAHrd3YW1BXHU_ZXRoidlccRtkCcREkfCNotqgIQ,1651
|
32
32
|
nucliadb_models/internal/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
33
33
|
nucliadb_models/internal/predict.py,sha256=5rgUPrH_98gerySOZ-TR2PX_qzCGF1_8VxyOu3bGhis,2281
|
34
34
|
nucliadb_models/internal/shards.py,sha256=bcnkxF_zViHZfT6WTAMBcWgY3UV-OAV65cVdSqGkcHY,1943
|
35
|
-
nucliadb_models-6.4.0.
|
36
|
-
nucliadb_models-6.4.0.
|
37
|
-
nucliadb_models-6.4.0.
|
38
|
-
nucliadb_models-6.4.0.
|
35
|
+
nucliadb_models-6.4.0.post4210.dist-info/METADATA,sha256=BDmVxJOvkuhM1pl3_L_w4x5sJh9xAzh-TstjiO5K5YQ,759
|
36
|
+
nucliadb_models-6.4.0.post4210.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
37
|
+
nucliadb_models-6.4.0.post4210.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
|
38
|
+
nucliadb_models-6.4.0.post4210.dist-info/RECORD,,
|
File without changes
|
{nucliadb_models-6.4.0.post4200.dist-info → nucliadb_models-6.4.0.post4210.dist-info}/top_level.txt
RENAMED
File without changes
|