streamlit-octostar-utils 0.4.2.dev22__tar.gz → 0.4.2.dev24__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 (46) hide show
  1. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/PKG-INFO +1 -1
  2. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/pyproject.toml +1 -1
  3. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/contents.py +14 -0
  4. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/nifi.py +11 -1
  5. streamlit_octostar_utils-0.4.2.dev22/streamlit_octostar_utils/octostar/constants.py +0 -1
  6. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/LICENSE +0 -0
  7. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/README.md +0 -0
  8. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/__init__.py +0 -0
  9. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/__init__.py +0 -0
  10. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/celery.py +0 -0
  11. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/fastapi.py +0 -0
  12. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parallelism.py +0 -0
  13. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/__init__.py +0 -0
  14. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/combine_fields.py +0 -0
  15. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/entities_parser.py +0 -0
  16. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/generics.py +0 -0
  17. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/info.py +0 -0
  18. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/linkchart_functions.py +0 -0
  19. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/matches.py +0 -0
  20. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/parameters.py +0 -0
  21. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/rules.py +0 -0
  22. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/api_crafter/parser/signals.py +0 -0
  23. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/__init__.py +0 -0
  24. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/dict.py +0 -0
  25. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/filetypes.py +0 -0
  26. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/threading/__init__.py +0 -0
  27. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/threading/key_queue.py +0 -0
  28. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/core/timestamp.py +0 -0
  29. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/nlp/__init__.py +0 -0
  30. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/nlp/custom_recognizers.py +0 -0
  31. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/nlp/language.py +0 -0
  32. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/nlp/ner.py +0 -0
  33. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/octostar/__init__.py +0 -0
  34. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/octostar/client.py +0 -0
  35. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/octostar/context.py +0 -0
  36. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/octostar/permissions.py +0 -0
  37. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/ontology/__init__.py +0 -0
  38. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/ontology/inheritance.py +0 -0
  39. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/ontology/relationships.py +0 -0
  40. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/ontology/validation.py +0 -0
  41. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/style/__init__.py +0 -0
  42. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/style/common.py +0 -0
  43. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/threading/__init__.py +0 -0
  44. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/threading/async_task_manager.py +0 -0
  45. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/streamlit_octostar_utils/threading/session_callback_manager.py +0 -0
  46. {streamlit_octostar_utils-0.4.2.dev22 → streamlit_octostar_utils-0.4.2.dev24}/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.4.2.dev22
3
+ Version: 0.4.2.dev24
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.4.2-dev.22"
8
+ version = "0.4.2-dev.24"
9
9
  description = ""
10
10
  license = "MIT"
11
11
  authors = ["Octostar"]
@@ -628,6 +628,13 @@ class WorkspaceAttachmentContents(Contents):
628
628
  super().close()
629
629
 
630
630
  def truncate(self, size: Optional[int] = None) -> int:
631
+ if not self._buffer and (size == 0 or (size is None and self._position == 0)):
632
+ self._buffer = BytesIO()
633
+ self._fully_loaded = True
634
+ self._size = 0
635
+ self._position = 0
636
+ self._modified = True
637
+ return 0
631
638
  self._modified = True
632
639
  return self._ensure_buffer().truncate(size)
633
640
 
@@ -902,6 +909,13 @@ class TemporaryAttachmentContents(Contents):
902
909
  super().close()
903
910
 
904
911
  def truncate(self, size: Optional[int] = None) -> int:
912
+ if not self._buffer and (size == 0 or (size is None and self._position == 0)):
913
+ self._buffer = BytesIO()
914
+ self._fully_loaded = True
915
+ self._size = 0
916
+ self._position = 0
917
+ self._modified = True
918
+ return 0
905
919
  self._modified = True
906
920
  return self._ensure_buffer().truncate(size)
907
921
 
@@ -25,7 +25,7 @@ from ..core.dict import recursive_update_dict, travel_dict, jsondict_hash
25
25
  from ..core.timestamp import now, string_to_datetime
26
26
  from .fastapi import DefaultErrorRoute, Route
27
27
  from ..ontology.inheritance import is_child_concept as is_child_concept_fn, get_label, get_label_keys
28
- from .contents import Contents, WorkspaceAttachmentContents, TemporaryAttachmentContents
28
+ from .contents import Contents, WorkspaceAttachmentContents, TemporaryAttachmentContents, MemoryContents
29
29
 
30
30
 
31
31
  class RelationshipName(BaseModel):
@@ -49,6 +49,8 @@ OS_RESERVED_FIELDS = [
49
49
  "entity_label", "os_created_at", "os_created_by",
50
50
  "os_last_updated_at", "os_last_updated_by",
51
51
  ]
52
+ MAX_IN_MEMORY_SIZE_BYTES = 5_242_880
53
+
52
54
 
53
55
  class NifiProxyEntityModel(BaseModel):
54
56
  entity_id: str
@@ -482,6 +484,7 @@ class NifiContextManager(object):
482
484
  filetype=filetype,
483
485
  fields=record,
484
486
  )
487
+ target.truncate(0)
485
488
  target.write(data)
486
489
  target.flush()
487
490
  file._contents = target
@@ -956,6 +959,12 @@ class NifiEntity(object):
956
959
  )
957
960
  if isinstance(file, Contents):
958
961
  child_entity._contents = file
962
+ elif len(file) <= MAX_IN_MEMORY_SIZE_BYTES:
963
+ child_entity._contents = MemoryContents(
964
+ entity_type=os_entity_type,
965
+ filetype=filetype,
966
+ initial_data=file,
967
+ )
959
968
  else:
960
969
  temp_filename = f"tmp_{child_entity.record['os_entity_uid']}"
961
970
  temp_contents = TemporaryAttachmentContents(
@@ -964,6 +973,7 @@ class NifiEntity(object):
964
973
  filename=temp_filename,
965
974
  client=self.context.client,
966
975
  )
976
+ temp_contents.truncate(0)
967
977
  temp_contents.write(file)
968
978
  temp_contents.flush()
969
979
  child_entity._contents = temp_contents
@@ -1 +0,0 @@
1
- OS_XMP_NAMESPACE = "http://octostar.io/ns/1.0/"