deltafi 2.4.0__py3-none-any.whl → 2.6.0__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 deltafi might be problematic. Click here for more details.
deltafi/domain.py
CHANGED
|
@@ -129,7 +129,7 @@ class Content:
|
|
|
129
129
|
A Content class that holds information about a piece of content, including its name, segments, mediaType, and service.
|
|
130
130
|
Attributes:
|
|
131
131
|
name (str): The name of the content.
|
|
132
|
-
segments (List<Segment): The list of segments in storage that make up the Content
|
|
132
|
+
segments (List<Segment>): The list of segments in storage that make up the Content
|
|
133
133
|
media_type (str): The media type of the content
|
|
134
134
|
content_service (ContentService): A ContentService object used to retrieve the content data.
|
|
135
135
|
"""
|
|
@@ -138,6 +138,7 @@ class Content:
|
|
|
138
138
|
self.name = name
|
|
139
139
|
self.segments = segments
|
|
140
140
|
self.media_type = media_type
|
|
141
|
+
self.tags = set()
|
|
141
142
|
self.content_service = content_service
|
|
142
143
|
|
|
143
144
|
def json(self):
|
|
@@ -150,7 +151,8 @@ class Content:
|
|
|
150
151
|
return {
|
|
151
152
|
'name': self.name,
|
|
152
153
|
'segments': [segment.json() for segment in self.segments],
|
|
153
|
-
'mediaType': self.media_type
|
|
154
|
+
'mediaType': self.media_type,
|
|
155
|
+
'tags': list(self.tags)
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
def copy(self):
|
|
@@ -160,10 +162,12 @@ class Content:
|
|
|
160
162
|
Returns:
|
|
161
163
|
Content: A deep copy of the Content object.
|
|
162
164
|
"""
|
|
163
|
-
|
|
165
|
+
new_copy = Content(name=self.name,
|
|
164
166
|
segments=copy.deepcopy(self.segments),
|
|
165
167
|
media_type=self.media_type,
|
|
166
168
|
content_service=self.content_service)
|
|
169
|
+
new_copy.add_tags(self.tags.copy())
|
|
170
|
+
return new_copy
|
|
167
171
|
|
|
168
172
|
def subcontent(self, offset: int, size: int):
|
|
169
173
|
"""
|
|
@@ -297,11 +301,66 @@ class Content:
|
|
|
297
301
|
segment_names[seg.id()] = seg
|
|
298
302
|
return segment_names
|
|
299
303
|
|
|
304
|
+
def add_tag(self, tag: str):
|
|
305
|
+
"""
|
|
306
|
+
Adds a tag to the content.
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
tag (str): The tag to add.
|
|
310
|
+
"""
|
|
311
|
+
self.tags.add(tag)
|
|
312
|
+
|
|
313
|
+
def add_tags(self, tags: set):
|
|
314
|
+
"""
|
|
315
|
+
Adds multiple tags to the content.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
tags (set): A set of tags to add.
|
|
319
|
+
"""
|
|
320
|
+
self.tags.update(tags)
|
|
321
|
+
|
|
322
|
+
def remove_tag(self, tag: str):
|
|
323
|
+
"""
|
|
324
|
+
Removes a tag from the content.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
tag (str): The tag to remove.
|
|
328
|
+
"""
|
|
329
|
+
self.tags.discard(tag)
|
|
330
|
+
|
|
331
|
+
def has_tag(self, tag: str) -> bool:
|
|
332
|
+
"""
|
|
333
|
+
Checks if the content has a specific tag.
|
|
334
|
+
|
|
335
|
+
Args:
|
|
336
|
+
tag (str): The tag to check.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
bool: True if the content has the tag, False otherwise.
|
|
340
|
+
"""
|
|
341
|
+
return tag in self.tags
|
|
342
|
+
|
|
343
|
+
def clear_tags(self):
|
|
344
|
+
"""
|
|
345
|
+
Clears all tags from the content.
|
|
346
|
+
"""
|
|
347
|
+
self.tags.clear()
|
|
348
|
+
|
|
349
|
+
def get_tags(self) -> set:
|
|
350
|
+
"""
|
|
351
|
+
Returns the tags associated with the content.
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
set: A set of tags.
|
|
355
|
+
"""
|
|
356
|
+
return self.tags
|
|
357
|
+
|
|
300
358
|
def __eq__(self, other):
|
|
301
359
|
if isinstance(other, Content):
|
|
302
360
|
return (self.name == other.name and
|
|
303
361
|
self.segments == other.segments and
|
|
304
362
|
self.media_type == other.media_type and
|
|
363
|
+
self.tags == other.tags and
|
|
305
364
|
self.content_service == other.content_service)
|
|
306
365
|
return False
|
|
307
366
|
|
|
@@ -323,10 +382,13 @@ class Content:
|
|
|
323
382
|
name = None
|
|
324
383
|
segments = [Segment.from_dict(segment) for segment in content['segments']]
|
|
325
384
|
media_type = content['mediaType']
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
385
|
+
action_content = Content(name=name,
|
|
386
|
+
segments=segments,
|
|
387
|
+
media_type=media_type,
|
|
388
|
+
content_service=content_service)
|
|
389
|
+
tags = set(content.get('tags', []))
|
|
390
|
+
action_content.add_tags(tags)
|
|
391
|
+
return action_content
|
|
330
392
|
|
|
331
393
|
|
|
332
394
|
class DeltaFileMessage(NamedTuple):
|
deltafi/result.py
CHANGED
|
@@ -112,16 +112,20 @@ class IngressResultItem:
|
|
|
112
112
|
|
|
113
113
|
return self
|
|
114
114
|
|
|
115
|
-
def save_string_content(self, string_data: str, name: str, media_type: str):
|
|
115
|
+
def save_string_content(self, string_data: str, name: str, media_type: str, tags: set = None):
|
|
116
116
|
segment = self.context.content_service.put_str(self._did, string_data)
|
|
117
117
|
c = Content(name=name, segments=[segment], media_type=media_type, content_service=self.context.content_service)
|
|
118
|
+
if tags is not None:
|
|
119
|
+
c.add_tags(tags)
|
|
118
120
|
self.content.append(c)
|
|
119
121
|
self.context.saved_content.append(c)
|
|
120
122
|
return self
|
|
121
123
|
|
|
122
|
-
def save_byte_content(self, byte_data: bytes, name: str, media_type: str):
|
|
124
|
+
def save_byte_content(self, byte_data: bytes, name: str, media_type: str, tags: set = None):
|
|
123
125
|
segment = self.context.content_service.put_bytes(self._did, byte_data)
|
|
124
126
|
c = Content(name=name, segments=[segment], media_type=media_type, content_service=self.context.content_service)
|
|
127
|
+
if tags is not None:
|
|
128
|
+
c.add_tags(tags)
|
|
125
129
|
self.content.append(c)
|
|
126
130
|
self.context.saved_content.append(c)
|
|
127
131
|
return self
|
|
@@ -207,16 +211,20 @@ class TransformResult(Result):
|
|
|
207
211
|
|
|
208
212
|
return self
|
|
209
213
|
|
|
210
|
-
def save_string_content(self, string_data: str, name: str, media_type: str):
|
|
214
|
+
def save_string_content(self, string_data: str, name: str, media_type: str, tags: set = None):
|
|
211
215
|
segment = self.context.content_service.put_str(self.context.did, string_data)
|
|
212
216
|
c = Content(name=name, segments=[segment], media_type=media_type, content_service=self.context.content_service)
|
|
217
|
+
if tags is not None:
|
|
218
|
+
c.add_tags(tags)
|
|
213
219
|
self.content.append(c)
|
|
214
220
|
self.context.saved_content.append(c)
|
|
215
221
|
return self
|
|
216
222
|
|
|
217
|
-
def save_byte_content(self, byte_data: bytes, name: str, media_type: str):
|
|
223
|
+
def save_byte_content(self, byte_data: bytes, name: str, media_type: str, tags: set = None):
|
|
218
224
|
segment = self.context.content_service.put_bytes(self.context.did, byte_data)
|
|
219
225
|
c = Content(name=name, segments=[segment], media_type=media_type, content_service=self.context.content_service)
|
|
226
|
+
if tags is not None:
|
|
227
|
+
c.add_tags(tags)
|
|
220
228
|
self.content.append(c)
|
|
221
229
|
self.context.saved_content.append(c)
|
|
222
230
|
return self
|
|
@@ -2,14 +2,14 @@ deltafi/__init__.py,sha256=FHwsfe4TgGeVLINN6940urXAzxGvl_Hof0gmOB32N7Y,709
|
|
|
2
2
|
deltafi/action.py,sha256=7fgFOcbNg_6Hex5KQZ7k54VCs--Tuk6ucS3nQnB-vYk,5753
|
|
3
3
|
deltafi/actioneventqueue.py,sha256=1waxnLAhoxP_nltYE107AdeFuxFdBuQDdtJjxiu2pT8,2847
|
|
4
4
|
deltafi/actiontype.py,sha256=2FnTbryP2zVlJfghrh9IqhIHWarPfSKSKt2UxoIrGLU,913
|
|
5
|
-
deltafi/domain.py,sha256=
|
|
5
|
+
deltafi/domain.py,sha256=XzHXLOZSUHIhlrj8jB7_UN-yYIgKVXFHji330k-TlsM,13670
|
|
6
6
|
deltafi/exception.py,sha256=t-Qr3PBp5vdvUeABMFg2iLl6x6Uy3PJl5uxENsnY4kM,943
|
|
7
7
|
deltafi/genericmodel.py,sha256=0qgii2o-fzHS6lM1C5X7_WTTSYsiZAM0i7RTfw0nw4U,1152
|
|
8
8
|
deltafi/input.py,sha256=_9Np2g7OzcAggaQnGw7DDWleGAoqud52z60YSqPNriM,1656
|
|
9
9
|
deltafi/logger.py,sha256=Lms9wmjyZWe9-SCKj4raNmGC9Cyn3BrfiniPXeM9VDY,2140
|
|
10
10
|
deltafi/metric.py,sha256=5Q40bLpNXk8mwu1wnN5L8GX22-iZxYEFBGt3zSNmYxI,972
|
|
11
11
|
deltafi/plugin.py,sha256=nZ3sGyggzz2w_O7E8DknNunb6mZpShj_np7IhuesJ18,17980
|
|
12
|
-
deltafi/result.py,sha256=
|
|
12
|
+
deltafi/result.py,sha256=j_3icJ74xIQo9KQV738XiqaFOYirjuIgFEtld4pBvXk,9555
|
|
13
13
|
deltafi/storage.py,sha256=zgBkaDTiT4BLEE1lAYjq4mqS4zqZKzuoVmG1CNbkD20,2979
|
|
14
14
|
deltafi/test_kit/__init__.py,sha256=FHwsfe4TgGeVLINN6940urXAzxGvl_Hof0gmOB32N7Y,709
|
|
15
15
|
deltafi/test_kit/assertions.py,sha256=itKLaI22PoiiDLHNrvRAAohcrKsbKuW5-ba0sg7J780,1594
|
|
@@ -19,6 +19,6 @@ deltafi/test_kit/egress.py,sha256=MXEsYsgiG1G-1zCuwV23RCn7w5bPObP1J0_7nVN03MU,18
|
|
|
19
19
|
deltafi/test_kit/framework.py,sha256=pU8tLsMNWUhVtIhLusbQL3uPT4y8xsKWdzzXuxmxRrU,15432
|
|
20
20
|
deltafi/test_kit/timed_ingress.py,sha256=ogk6AzbPZInLOPMYy3MhjEXpITPn9-Ha6YSILGBdpro,4177
|
|
21
21
|
deltafi/test_kit/transform.py,sha256=7KOsNY9OSDiyTFXIx0knZeweXIA421vHS6PAxQAcOc0,4122
|
|
22
|
-
deltafi-2.
|
|
23
|
-
deltafi-2.
|
|
24
|
-
deltafi-2.
|
|
22
|
+
deltafi-2.6.0.dist-info/METADATA,sha256=GNSZoJda92BlYosPP8zazhaPPzA2e60pVigShFbxUxM,1517
|
|
23
|
+
deltafi-2.6.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
24
|
+
deltafi-2.6.0.dist-info/RECORD,,
|
|
File without changes
|