streamlit-octostar-utils 0.5.0.dev3__tar.gz → 0.5.0.dev5__tar.gz

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.
Files changed (45) hide show
  1. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/PKG-INFO +1 -1
  2. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/pyproject.toml +1 -1
  3. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/nifi.py +50 -20
  4. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/LICENSE +0 -0
  5. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/README.md +0 -0
  6. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/__init__.py +0 -0
  7. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/__init__.py +0 -0
  8. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/celery.py +0 -0
  9. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/contents.py +0 -0
  10. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/fastapi.py +0 -0
  11. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parallelism.py +0 -0
  12. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/__init__.py +0 -0
  13. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/combine_fields.py +0 -0
  14. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/entities_parser.py +0 -0
  15. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/generics.py +0 -0
  16. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/info.py +0 -0
  17. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/linkchart_functions.py +0 -0
  18. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/matches.py +0 -0
  19. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/parameters.py +0 -0
  20. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/rules.py +0 -0
  21. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/api_crafter/parser/signals.py +0 -0
  22. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/__init__.py +0 -0
  23. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/dict.py +0 -0
  24. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/filetypes.py +0 -0
  25. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/threading/__init__.py +0 -0
  26. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/threading/key_queue.py +0 -0
  27. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/core/timestamp.py +0 -0
  28. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/nlp/__init__.py +0 -0
  29. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/nlp/custom_recognizers.py +0 -0
  30. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/nlp/language.py +0 -0
  31. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/nlp/ner.py +0 -0
  32. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/octostar/__init__.py +0 -0
  33. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/octostar/client.py +0 -0
  34. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/octostar/context.py +0 -0
  35. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/octostar/permissions.py +0 -0
  36. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/ontology/__init__.py +0 -0
  37. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/ontology/inheritance.py +0 -0
  38. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/ontology/relationships.py +0 -0
  39. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/ontology/validation.py +0 -0
  40. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/style/__init__.py +0 -0
  41. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/style/common.py +0 -0
  42. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/threading/__init__.py +0 -0
  43. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/threading/async_task_manager.py +0 -0
  44. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/threading/session_callback_manager.py +0 -0
  45. {streamlit_octostar_utils-0.5.0.dev3 → streamlit_octostar_utils-0.5.0.dev5}/streamlit_octostar_utils/threading/session_state_hot_swapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-octostar-utils
3
- Version: 0.5.0.dev3
3
+ Version: 0.5.0.dev5
4
4
  Summary:
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -5,7 +5,7 @@ include = '\.pyi?$'
5
5
 
6
6
  [tool.poetry]
7
7
  name = "streamlit-octostar-utils"
8
- version = "0.5.0-dev.3"
8
+ version = "0.5.0-dev.5"
9
9
  description = ""
10
10
  license = "MIT"
11
11
  authors = ["Octostar"]
@@ -73,7 +73,7 @@ class NifiEntityModel(BaseModel):
73
73
  relationships: List[str]
74
74
  label_keys: List[str]
75
75
 
76
- jwt: str
76
+ jwt: Optional[str] = None
77
77
  ontology_name: str
78
78
  ontology_info: OntologyInfoModel
79
79
  entity_timestamp: Optional[str]
@@ -624,7 +624,8 @@ class NifiContextManager(object):
624
624
  {
625
625
  "entity_id": e["os_entity_uid"],
626
626
  "entity_type": e["os_concept"],
627
- "do_not_reindex_at": long_expiry,
627
+ "do_not_reindex_before": long_expiry,
628
+ "do_not_update_before": long_expiry,
628
629
  }
629
630
  for e in entities
630
631
  ]
@@ -637,7 +638,8 @@ class NifiContextManager(object):
637
638
  {
638
639
  "entity_id": e["os_entity_uid"],
639
640
  "entity_type": e["os_concept"],
640
- "do_not_reindex_at": short_expiry,
641
+ "do_not_reindex_before": short_expiry,
642
+ "do_not_update_before": short_expiry,
641
643
  }
642
644
  for e in entities
643
645
  ]
@@ -722,7 +724,6 @@ class NifiContextManager(object):
722
724
  {
723
725
  "entity_type": entity.record["os_concept"],
724
726
  "os_entity_uid": entity.record["os_entity_uid"],
725
- "os_last_updated_at": entity.request["entity_timestamp"],
726
727
  "fields": {k: entity.record.get(k) for k in fields},
727
728
  }
728
729
  for entity, fields in entities_to_upsert
@@ -1186,6 +1187,48 @@ class NifiEntity(object):
1186
1187
  self.children.append(child_entity_proxy)
1187
1188
  return child_entity_proxy
1188
1189
 
1190
+ def prepare_contents(
1191
+ self,
1192
+ file: Union[Contents, bytes],
1193
+ entity_type: str,
1194
+ filetype: str,
1195
+ temp_blob_key: Optional[str] = None,
1196
+ ) -> Contents:
1197
+ """Build a Contents object from raw bytes, mirroring the same
1198
+ MemoryContents / TemporaryAttachmentContents logic used internally.
1199
+
1200
+ Thread-safe: each call creates independent objects keyed by
1201
+ *temp_blob_key* (for large blobs) and does not mutate the entity tree.
1202
+ The returned Contents can later be passed to ``add_child_fragment``
1203
+ or ``add_child_file`` to skip the redundant bytes→Contents conversion.
1204
+
1205
+ Args:
1206
+ file: A Contents object (returned as-is) or raw bytes.
1207
+ entity_type: Concept / entity type for the contents metadata.
1208
+ filetype: MIME type for the contents metadata.
1209
+ temp_blob_key: Unique key for the temporary blob when the data
1210
+ exceeds the in-memory threshold. Defaults to a random UUID.
1211
+ """
1212
+ if isinstance(file, Contents):
1213
+ return file
1214
+ if len(file) <= MAX_IN_MEMORY_SIZE_BYTES:
1215
+ return MemoryContents(
1216
+ entity_type=entity_type,
1217
+ filetype=filetype,
1218
+ initial_data=file,
1219
+ )
1220
+ temp_filename = temp_blob_key or f"tmp_{uuid.uuid4()}"
1221
+ temp_contents = TemporaryAttachmentContents(
1222
+ entity_type=entity_type,
1223
+ filetype=filetype,
1224
+ filename=temp_filename,
1225
+ client=self.context.client,
1226
+ )
1227
+ temp_contents.truncate(0)
1228
+ temp_contents.write(file)
1229
+ temp_contents.flush()
1230
+ return temp_contents
1231
+
1189
1232
  def _add_child_attachable(
1190
1233
  self,
1191
1234
  os_workspace,
@@ -1213,24 +1256,11 @@ class NifiEntity(object):
1213
1256
  )
1214
1257
  if isinstance(file, Contents):
1215
1258
  child_entity._contents = file
1216
- elif len(file) <= MAX_IN_MEMORY_SIZE_BYTES:
1217
- child_entity._contents = MemoryContents(
1218
- entity_type=os_entity_type,
1219
- filetype=filetype,
1220
- initial_data=file,
1221
- )
1222
1259
  else:
1223
- temp_filename = f"tmp_{child_entity.record['os_entity_uid']}"
1224
- temp_contents = TemporaryAttachmentContents(
1225
- entity_type=os_entity_type,
1226
- filetype=filetype,
1227
- filename=temp_filename,
1228
- client=self.context.client,
1260
+ child_entity._contents = self.prepare_contents(
1261
+ file, os_entity_type, filetype,
1262
+ temp_blob_key=f"tmp_{child_entity.record['os_entity_uid']}",
1229
1263
  )
1230
- temp_contents.truncate(0)
1231
- temp_contents.write(file)
1232
- temp_contents.flush()
1233
- child_entity._contents = temp_contents
1234
1264
  child_entity.sync_params = recursive_update_dict(
1235
1265
  child_entity.sync_params,
1236
1266
  {NifiContextManager.SyncFlag.WRITE_CONTENTS: True},