logs-py 2.9.5__py3-none-any.whl → 3.0.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 logs-py might be problematic. Click here for more details.
- LOGS/Auxiliary/DateTimeConverter.py +11 -1
- LOGS/Auxiliary/Exceptions.py +40 -4
- LOGS/Auxiliary/LOGSErrorResponse.py +4 -1
- LOGS/Auxiliary/MinimalModelGenerator.py +88 -28
- LOGS/Auxiliary/Tools.py +11 -0
- LOGS/Converter/Conversion.py +248 -0
- LOGS/Converter/Converter.py +96 -0
- LOGS/Converter/ConverterParameter.py +88 -0
- LOGS/Converter/ExportParamters.py +89 -0
- LOGS/Converter/__init__.py +13 -0
- LOGS/Entities/Bridge.py +6 -3
- LOGS/Entities/CustomField.py +98 -93
- LOGS/Entities/CustomFieldModels.py +57 -0
- LOGS/Entities/CustomFieldRelations.py +10 -0
- LOGS/Entities/CustomFieldRequestParameter.py +43 -15
- LOGS/Entities/CustomFieldValue.py +88 -0
- LOGS/Entities/CustomFieldValueConverter.py +66 -0
- LOGS/Entities/CustomType.py +187 -0
- LOGS/Entities/CustomTypeEntityType.py +11 -0
- LOGS/Entities/CustomTypeMinimal.py +8 -0
- LOGS/Entities/CustomTypeRelations.py +59 -0
- LOGS/Entities/CustomTypeRequestParameter.py +61 -0
- LOGS/Entities/CustomTypeSection.py +39 -0
- LOGS/Entities/CustomTypes.py +12 -0
- LOGS/Entities/DataSource.py +28 -14
- LOGS/Entities/Dataset.py +276 -138
- LOGS/Entities/DatasetCreator.py +23 -72
- LOGS/Entities/DatasetInfo.py +23 -2
- LOGS/Entities/DatasetModels.py +31 -0
- LOGS/Entities/DatasetRequestParameter.py +45 -32
- LOGS/Entities/Datatrack.py +74 -30
- LOGS/Entities/DatatrackFormattedTable.py +25 -0
- LOGS/Entities/DatatrackGeneric.py +34 -0
- LOGS/Entities/DatatrackImage.py +25 -0
- LOGS/Entities/DatatrackNumericArray.py +9 -39
- LOGS/Entities/DatatrackNumericMatrix.py +86 -0
- LOGS/Entities/DocumentRequestParameter.py +2 -2
- LOGS/Entities/EntitiesRequestParameter.py +2 -2
- LOGS/Entities/Experiment.py +3 -3
- LOGS/Entities/FileExcludePattern.py +8 -0
- LOGS/Entities/FormatFormat.py +22 -1
- LOGS/Entities/FormatFormatRequestParameter.py +2 -1
- LOGS/Entities/FormatFormats.py +1 -1
- LOGS/Entities/FormatMethod.py +2 -2
- LOGS/Entities/FormattedTable/DatatypeFormattedTable.py +135 -0
- LOGS/Entities/FormattedTable/DatatypeFormattedTableCell.py +108 -0
- LOGS/Entities/FormattedTable/DatatypeFormattedTableSettings.py +11 -0
- LOGS/Entities/FormattedTable/__init__.py +9 -0
- LOGS/Entities/ILiterarTypedEntity.py +19 -0
- LOGS/Entities/Instrument.py +3 -3
- LOGS/Entities/Inventories.py +12 -0
- LOGS/Entities/Inventory.py +95 -0
- LOGS/Entities/InventoryMinimal.py +20 -0
- LOGS/Entities/InventoryRelations.py +23 -0
- LOGS/Entities/InventoryRequestParameter.py +53 -0
- LOGS/Entities/LabNotebook.py +37 -0
- LOGS/Entities/LabNotebookEntry.py +50 -27
- LOGS/Entities/LabNotebookEntryContent/BasicAttribute.py +15 -0
- LOGS/Entities/LabNotebookEntryContent/EntityAttribute.py +85 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentBlockquote.py +13 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentBulletList.py +17 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentCallout.py +40 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentContentPlaceholderNode.py +31 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentConverter.py +207 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentDocument.py +8 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentEntity.py +13 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentEntityMention.py +31 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentHeading.py +33 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentHorizontalRule.py +12 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentItem.py +37 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentListItem.py +49 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentOrderedList.py +31 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentParagraph.py +13 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentTable.py +17 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentTableCell.py +40 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentTableRow.py +8 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentTaskList.py +17 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentTaskListItem.py +31 -0
- LOGS/Entities/LabNotebookEntryContent/EntryContentText.py +33 -0
- LOGS/Entities/LabNotebookEntryContent/IEntryContentWithAttribute.py +23 -0
- LOGS/Entities/LabNotebookEntryContent/IEntryContentWithContent.py +38 -0
- LOGS/Entities/LabNotebookEntryContent/IEntryContentWithTextAttribute.py +16 -0
- LOGS/Entities/LabNotebookEntryContent/TextAttribute.py +46 -0
- LOGS/Entities/LabNotebookEntryContent/TextMarkAtributes.py +64 -0
- LOGS/Entities/LabNotebookEntryContent/TextMarkConverter.py +45 -0
- LOGS/Entities/LabNotebookEntryContent/TextMarks.py +71 -0
- LOGS/Entities/LabNotebookEntryContent/__init__.py +34 -0
- LOGS/Entities/LabNotebookEntryRequestParameter.py +2 -0
- LOGS/Entities/LabNotebookExperiment.py +52 -0
- LOGS/Entities/LabNotebookExperimentMinimal.py +8 -0
- LOGS/Entities/LabNotebookExperimentRequestParameter.py +49 -0
- LOGS/Entities/LabNotebookExperiments.py +16 -0
- LOGS/Entities/LabNotebookMinimal.py +19 -0
- LOGS/Entities/LabNotebookModels.py +14 -0
- LOGS/Entities/LabNotebookRequestParameter.py +43 -0
- LOGS/Entities/LabNotebooks.py +12 -0
- LOGS/Entities/Method.py +3 -3
- LOGS/Entities/ParserLog.py +4 -0
- LOGS/Entities/Person.py +2 -2
- LOGS/Entities/Project.py +7 -7
- LOGS/Entities/{ProjectUserPermission.py → ProjectPersonPermission.py} +14 -4
- LOGS/Entities/Role.py +3 -3
- LOGS/Entities/RunState.py +1 -0
- LOGS/Entities/Sample.py +36 -57
- LOGS/Entities/SampleRequestParameter.py +30 -15
- LOGS/Entities/Track.py +10 -6
- LOGS/Entities/TrackData.py +11 -0
- LOGS/Entities/TrackImage.py +21 -0
- LOGS/Entities/TrackImageData.py +20 -0
- LOGS/Entities/TrackMatrix.py +28 -0
- LOGS/Entities/TrackMatrixData.py +22 -0
- LOGS/Entities/TrackTable.py +21 -0
- LOGS/Entities/TrackTableData.py +22 -0
- LOGS/Entities/TrackXY.py +5 -1
- LOGS/Entities/TrackXYComplex.py +1 -1
- LOGS/Entities/__init__.py +26 -7
- LOGS/Entity/ConnectedEntity.py +39 -1
- LOGS/Entity/Entity.py +9 -14
- LOGS/Entity/SerializeableContent.py +127 -45
- LOGS/Interfaces/IHierarchyType.py +63 -0
- LOGS/Interfaces/IPermissionedEntity.py +29 -5
- LOGS/Interfaces/IProjectBased.py +1 -1
- LOGS/Interfaces/IRelatedEntity.py +3 -2
- LOGS/Interfaces/ITypedEntity.py +69 -12
- LOGS/Interfaces/IVersionedEntity.py +39 -0
- LOGS/LOGS.py +140 -48
- LOGS/LOGSConnection.py +52 -24
- LOGS/LOGSOptions.py +8 -0
- LOGS/Parameters/Color.py +92 -0
- LOGS/Parameters/ParameterBase.py +55 -0
- LOGS/Parameters/ParameterConverter.py +24 -0
- LOGS/Parameters/ParameterElement.py +99 -0
- LOGS/Parameters/ParameterList.py +52 -0
- LOGS/Parameters/ParameterTable.py +64 -0
- LOGS/Parameters/__init__.py +13 -0
- LOGS/__init__.py +1 -0
- {logs_py-2.9.5.dist-info → logs_py-3.0.0.dist-info}/METADATA +3 -2
- logs_py-3.0.0.dist-info/RECORD +263 -0
- {logs_py-2.9.5.dist-info → logs_py-3.0.0.dist-info}/WHEEL +1 -1
- LOGS/Entities/CustomFieldEnums.py +0 -25
- LOGS/Entities/DatasetType.py +0 -7
- LOGS/Entities/DatasetTypeMinimal.py +0 -8
- LOGS/Entities/SampleType.py +0 -34
- LOGS/Entities/SampleTypeMinimal.py +0 -8
- LOGS/Entities/SampleTypeRequestParameter.py +0 -8
- LOGS/Entities/SampleTypes.py +0 -12
- logs_py-2.9.5.dist-info/RECORD +0 -183
- {logs_py-2.9.5.dist-info → logs_py-3.0.0.dist-info}/top_level.txt +0 -0
|
@@ -2,16 +2,22 @@ from datetime import datetime
|
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
4
|
from LOGS.Auxiliary.Decorators import Endpoint
|
|
5
|
+
from LOGS.Auxiliary.Exceptions import EntityFetchingException, EntityIncompleteException
|
|
6
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentConverter import (
|
|
7
|
+
EntryContentConverter,
|
|
8
|
+
)
|
|
9
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentDocument import (
|
|
10
|
+
EntryContentDocument,
|
|
11
|
+
)
|
|
5
12
|
from LOGS.Entities.LabNotebookEntryRelations import LabNotebookEntryRelations
|
|
6
13
|
from LOGS.Entity.EntityMinimalWithIntId import EntityMinimalWithIntId
|
|
7
14
|
from LOGS.Entity.EntityWithIntId import IEntityWithIntId
|
|
8
15
|
from LOGS.Interfaces.ICreationRecord import ICreationRecord
|
|
9
16
|
from LOGS.Interfaces.IModificationRecord import IModificationRecord
|
|
10
17
|
from LOGS.Interfaces.INamedEntity import INamedEntity
|
|
11
|
-
from LOGS.Interfaces.IPermissionedEntity import
|
|
18
|
+
from LOGS.Interfaces.IPermissionedEntity import GenericPermissionEntity
|
|
12
19
|
from LOGS.Interfaces.IRelatedEntity import IRelatedEntity
|
|
13
20
|
from LOGS.Interfaces.ISoftDeletable import ISoftDeletable
|
|
14
|
-
from LOGS.LOGSConnection import LOGSConnection
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
@Endpoint("lab_notebook_entries")
|
|
@@ -22,35 +28,33 @@ class LabNotebookEntry(
|
|
|
22
28
|
ICreationRecord,
|
|
23
29
|
IModificationRecord,
|
|
24
30
|
ISoftDeletable,
|
|
25
|
-
|
|
31
|
+
GenericPermissionEntity,
|
|
26
32
|
):
|
|
27
|
-
_relationType =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
id: Optional[int] = None,
|
|
38
|
-
connection: Optional[LOGSConnection] = None,
|
|
39
|
-
):
|
|
40
|
-
"""Represents a connected LOGS entity type"""
|
|
41
|
-
self._version = None
|
|
42
|
-
self._labNotebook = None
|
|
43
|
-
self._labNotebookExperiment = None
|
|
44
|
-
self._entryDate = None
|
|
45
|
-
|
|
46
|
-
super().__init__(ref=ref, id=id, connection=connection)
|
|
47
|
-
|
|
48
|
-
def fromDict(self, ref, formatDict=None) -> None:
|
|
33
|
+
_relationType = LabNotebookEntryRelations
|
|
34
|
+
_noContent: bool = True
|
|
35
|
+
|
|
36
|
+
_version: Optional[int] = None
|
|
37
|
+
_labNotebook: Optional[EntityMinimalWithIntId] = None
|
|
38
|
+
_labNotebookExperiment: Optional[EntityMinimalWithIntId] = None
|
|
39
|
+
_entryDate: Optional[datetime] = None
|
|
40
|
+
_content: Optional[EntryContentDocument] = None
|
|
41
|
+
|
|
42
|
+
def fromDict(self, ref) -> None:
|
|
49
43
|
if isinstance(ref, dict):
|
|
50
|
-
if "name" in ref:
|
|
44
|
+
if "name" in ref and ref["name"]:
|
|
51
45
|
ref["name"] = ref["name"].replace(" > ", "_")
|
|
52
46
|
|
|
53
|
-
super().fromDict(ref
|
|
47
|
+
super().fromDict(ref)
|
|
48
|
+
|
|
49
|
+
def fetchContent(self):
|
|
50
|
+
connection, endpoint, id = self._getConnectionData()
|
|
51
|
+
|
|
52
|
+
content, responseError = connection.getEndpoint(endpoint + [id, "content"])
|
|
53
|
+
if responseError:
|
|
54
|
+
raise EntityFetchingException(entity=self, responseError=responseError)
|
|
55
|
+
|
|
56
|
+
self.content = content
|
|
57
|
+
self._noContent = False
|
|
54
58
|
|
|
55
59
|
@property
|
|
56
60
|
def version(self) -> Optional[int]:
|
|
@@ -87,3 +91,22 @@ class LabNotebookEntry(
|
|
|
87
91
|
@entryDate.setter
|
|
88
92
|
def entryDate(self, value):
|
|
89
93
|
self._entryDate = self.checkAndConvertNullable(value, datetime, "entryDate")
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def content(self) -> Optional[EntryContentDocument]:
|
|
97
|
+
if self._noContent:
|
|
98
|
+
raise EntityIncompleteException(
|
|
99
|
+
self,
|
|
100
|
+
parameterName="content",
|
|
101
|
+
functionName=f"{self.fetchContent.__name__}()",
|
|
102
|
+
hasFetchFull=False,
|
|
103
|
+
)
|
|
104
|
+
return self._content
|
|
105
|
+
|
|
106
|
+
@content.setter
|
|
107
|
+
def content(self, value):
|
|
108
|
+
if value:
|
|
109
|
+
self._noContent = False
|
|
110
|
+
self._content = EntryContentConverter[EntryContentDocument].convert(
|
|
111
|
+
value, fieldName="content"
|
|
112
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entity.SerializeableContent import SerializeableContent
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BasicAttribute(SerializeableContent):
|
|
7
|
+
_id: Optional[str] = None
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def id(self) -> Optional[str]:
|
|
11
|
+
return self._id
|
|
12
|
+
|
|
13
|
+
@id.setter
|
|
14
|
+
def id(self, value):
|
|
15
|
+
self._id = self.checkAndConvertNullable(value, str, "id")
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.BasicAttribute import BasicAttribute
|
|
4
|
+
from LOGS.Entity.SerializeableContent import SerializeableClass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EntityAttributeSettings(SerializeableClass):
|
|
8
|
+
showHeader: Optional[bool] = None
|
|
9
|
+
collapsible: Optional[bool] = None
|
|
10
|
+
defaultCollapsed: Optional[bool] = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EntityAttributeAdditionalSettings(SerializeableClass):
|
|
14
|
+
height: Optional[int] = None
|
|
15
|
+
showViewer: Optional[bool] = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class EntityAttribute(BasicAttribute):
|
|
19
|
+
_version: Optional[int] = None
|
|
20
|
+
_entityId: Optional[int] = None
|
|
21
|
+
_settings: Optional[EntityAttributeSettings] = None
|
|
22
|
+
_additionalSettings: Optional[EntityAttributeAdditionalSettings] = None
|
|
23
|
+
_entityUuid: Optional[str] = None
|
|
24
|
+
_entityTypeId: Optional[str] = None
|
|
25
|
+
_style: Optional[str] = None
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def style(self) -> Optional[str]:
|
|
29
|
+
return self._style
|
|
30
|
+
|
|
31
|
+
@style.setter
|
|
32
|
+
def style(self, value):
|
|
33
|
+
self._style = self.checkAndConvertNullable(value, str, "style")
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def entityTypeId(self) -> Optional[str]:
|
|
37
|
+
return self._entityTypeId
|
|
38
|
+
|
|
39
|
+
@entityTypeId.setter
|
|
40
|
+
def entityTypeId(self, value):
|
|
41
|
+
self._entityTypeId = self.checkAndConvertNullable(value, str, "entityTypeId")
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def entityUuid(self) -> Optional[str]:
|
|
45
|
+
return self._entityUuid
|
|
46
|
+
|
|
47
|
+
@entityUuid.setter
|
|
48
|
+
def entityUuid(self, value):
|
|
49
|
+
self._entityUuid = self.checkAndConvertNullable(value, str, "entityUuid")
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def version(self) -> Optional[int]:
|
|
53
|
+
return self._version
|
|
54
|
+
|
|
55
|
+
@version.setter
|
|
56
|
+
def version(self, value):
|
|
57
|
+
self._version = self.checkAndConvertNullable(value, int, "version")
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def entityId(self) -> Optional[int]:
|
|
61
|
+
return self._entityId
|
|
62
|
+
|
|
63
|
+
@entityId.setter
|
|
64
|
+
def entityId(self, value):
|
|
65
|
+
self._entityId = self.checkAndConvertNullable(value, int, "entityId")
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def settings(self) -> Optional[EntityAttributeSettings]:
|
|
69
|
+
return self._settings
|
|
70
|
+
|
|
71
|
+
@settings.setter
|
|
72
|
+
def settings(self, value):
|
|
73
|
+
self._settings = self.checkAndConvertNullable(
|
|
74
|
+
value, EntityAttributeSettings, "settings"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def additionalSettings(self) -> Optional[EntityAttributeAdditionalSettings]:
|
|
79
|
+
return self._additionalSettings
|
|
80
|
+
|
|
81
|
+
@additionalSettings.setter
|
|
82
|
+
def additionalSettings(self, value):
|
|
83
|
+
self._additionalSettings = self.checkAndConvertNullable(
|
|
84
|
+
value, EntityAttributeAdditionalSettings, "additionalSettings"
|
|
85
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
2
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
3
|
+
IEntryContentWithContent,
|
|
4
|
+
)
|
|
5
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithTextAttribute import (
|
|
6
|
+
IEntryContentWithTextAttribute,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EntryContentBlockquote(
|
|
11
|
+
EntryContentItem, IEntryContentWithContent, IEntryContentWithTextAttribute
|
|
12
|
+
):
|
|
13
|
+
_type = "blockquote"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
2
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
3
|
+
IEntryContentWithAttribute,
|
|
4
|
+
)
|
|
5
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
6
|
+
IEntryContentWithContent,
|
|
7
|
+
)
|
|
8
|
+
from LOGS.Entities.LabNotebookEntryContent.TextMarkAtributes import BasicAttribute
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class EntryContentBulletList(
|
|
12
|
+
EntryContentItem,
|
|
13
|
+
IEntryContentWithContent,
|
|
14
|
+
IEntryContentWithAttribute[BasicAttribute],
|
|
15
|
+
):
|
|
16
|
+
_attrType = BasicAttribute
|
|
17
|
+
_type = "bulletList"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.BasicAttribute import BasicAttribute
|
|
4
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
5
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
6
|
+
IEntryContentWithAttribute,
|
|
7
|
+
)
|
|
8
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
9
|
+
IEntryContentWithContent,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CalloutAttribute(BasicAttribute):
|
|
14
|
+
_type: Optional[str] = None
|
|
15
|
+
_emoji: Optional[str] = None
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def type(self) -> Optional[str]:
|
|
19
|
+
return self._type
|
|
20
|
+
|
|
21
|
+
@type.setter
|
|
22
|
+
def type(self, value):
|
|
23
|
+
self._type = self.checkAndConvertNullable(value, str, "type")
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def emoji(self) -> Optional[str]:
|
|
27
|
+
return self._emoji
|
|
28
|
+
|
|
29
|
+
@emoji.setter
|
|
30
|
+
def emoji(self, value):
|
|
31
|
+
self._emoji = self.checkAndConvertNullable(value, str, "emoji")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class EntryContentCallout(
|
|
35
|
+
EntryContentItem,
|
|
36
|
+
IEntryContentWithContent,
|
|
37
|
+
IEntryContentWithAttribute[CalloutAttribute],
|
|
38
|
+
):
|
|
39
|
+
_attrType = CalloutAttribute
|
|
40
|
+
_type = "callout"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
4
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
5
|
+
IEntryContentWithAttribute,
|
|
6
|
+
)
|
|
7
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
8
|
+
IEntryContentWithContent,
|
|
9
|
+
)
|
|
10
|
+
from LOGS.Entities.LabNotebookEntryContent.TextAttribute import TextAttribute
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PlaceholderNodeAttribute(TextAttribute):
|
|
14
|
+
_label: Optional[str] = None
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def label(self) -> Optional[str]:
|
|
18
|
+
return self._label
|
|
19
|
+
|
|
20
|
+
@label.setter
|
|
21
|
+
def label(self, value):
|
|
22
|
+
self._label = self.checkAndConvertNullable(value, str, "label")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class EntryContentContentPlaceholderNode(
|
|
26
|
+
EntryContentItem,
|
|
27
|
+
IEntryContentWithContent,
|
|
28
|
+
IEntryContentWithAttribute[PlaceholderNodeAttribute],
|
|
29
|
+
):
|
|
30
|
+
_attrType = PlaceholderNodeAttribute
|
|
31
|
+
_type = "contentPlaceholderNode"
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
from typing import Generic, Optional, TypeVar, cast
|
|
2
|
+
|
|
3
|
+
from LOGS.Auxiliary.Tools import Tools
|
|
4
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
5
|
+
|
|
6
|
+
_T = TypeVar("_T", bound=EntryContentItem)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class EntryContentConverter(Generic[_T]):
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def _convertEntryContentDocument(cls, item: dict):
|
|
13
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentDocument import (
|
|
14
|
+
EntryContentDocument,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
return EntryContentDocument(item)
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def _convertEntryContentHeading(cls, item: dict):
|
|
21
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentHeading import (
|
|
22
|
+
EntryContentHeading,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
return EntryContentHeading(item)
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def _convertEntryContentText(cls, item: dict):
|
|
29
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentText import (
|
|
30
|
+
EntryContentText,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return EntryContentText(item)
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def _convertEntryContentParagraph(cls, item: dict):
|
|
37
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentParagraph import (
|
|
38
|
+
EntryContentParagraph,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return EntryContentParagraph(item)
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def _convertEntryContentBlockquote(cls, item: dict):
|
|
45
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentBlockquote import (
|
|
46
|
+
EntryContentBlockquote,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return EntryContentBlockquote(item)
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def _convertEntryContentBulletList(cls, item: dict):
|
|
53
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentBulletList import (
|
|
54
|
+
EntryContentBulletList,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return EntryContentBulletList(item)
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def _convertEntryContentOrderedList(cls, item: dict):
|
|
61
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentOrderedList import (
|
|
62
|
+
EntryContentOrderedList,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return EntryContentOrderedList(item)
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def _convertEntryContentCallout(cls, item: dict):
|
|
69
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentCallout import (
|
|
70
|
+
EntryContentCallout,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return EntryContentCallout(item)
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def _convertEntryContentContentPlaceholderNode(cls, item: dict):
|
|
77
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentContentPlaceholderNode import (
|
|
78
|
+
EntryContentContentPlaceholderNode,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return EntryContentContentPlaceholderNode(item)
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def _convertEntryContentEntity(cls, item: dict):
|
|
85
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentEntity import (
|
|
86
|
+
EntryContentEntity,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return EntryContentEntity(item)
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def _convertEntryContentEntityMention(cls, item: dict):
|
|
93
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentEntityMention import (
|
|
94
|
+
EntryContentEntityMention,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return EntryContentEntityMention(item)
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def _convertEntryContentHorizontalRule(cls, item: dict):
|
|
101
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentHorizontalRule import (
|
|
102
|
+
EntryContentHorizontalRule,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return EntryContentHorizontalRule(item)
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def _convertEntryContentListItem(cls, item: dict):
|
|
109
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentListItem import (
|
|
110
|
+
EntryContentListItem,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return EntryContentListItem(item)
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def _convertEntryContentTaskList(cls, item: dict):
|
|
117
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentTaskList import (
|
|
118
|
+
EntryContentTaskList,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return EntryContentTaskList(item)
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def _convertEntryContentTaskListItem(cls, item: dict):
|
|
125
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentTaskListItem import (
|
|
126
|
+
EntryContentTaskListItem,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return EntryContentTaskListItem(item)
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def _convertEntryContentTable(cls, item: dict):
|
|
133
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentTable import (
|
|
134
|
+
EntryContentTable,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
return EntryContentTable(item)
|
|
138
|
+
|
|
139
|
+
@classmethod
|
|
140
|
+
def _convertEntryContentTableCell(cls, item: dict):
|
|
141
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentTableCell import (
|
|
142
|
+
EntryContentTableCell,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return EntryContentTableCell(item)
|
|
146
|
+
|
|
147
|
+
@classmethod
|
|
148
|
+
def _convertEntryContentTableRow(cls, item: dict):
|
|
149
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentTableRow import (
|
|
150
|
+
EntryContentTableRow,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
return EntryContentTableRow(item)
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def convert(cls, item: dict, fieldName: Optional[str] = None) -> _T:
|
|
157
|
+
field = f"in field {fieldName}" if fieldName else ""
|
|
158
|
+
|
|
159
|
+
if isinstance(item, EntryContentItem):
|
|
160
|
+
return cast(_T, item)
|
|
161
|
+
|
|
162
|
+
if not isinstance(item, dict):
|
|
163
|
+
raise ValueError(
|
|
164
|
+
f"EntryContentItem {field} must be of type 'dict'. (Got type '{type(item).__name__}')"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
if "type" not in item:
|
|
168
|
+
raise ValueError(
|
|
169
|
+
f"EntryContentItem {field} must contain a 'type' field. (Got '{Tools.truncString(str(item))}')"
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
_typeMapper = {
|
|
173
|
+
"blockquote": cls._convertEntryContentBlockquote,
|
|
174
|
+
"bulletList": cls._convertEntryContentBulletList,
|
|
175
|
+
"callout": cls._convertEntryContentCallout,
|
|
176
|
+
"contentPlaceholderNode": cls._convertEntryContentContentPlaceholderNode,
|
|
177
|
+
"doc": cls._convertEntryContentDocument,
|
|
178
|
+
"entity": cls._convertEntryContentEntity,
|
|
179
|
+
"entityMention": cls._convertEntryContentEntityMention,
|
|
180
|
+
"heading": cls._convertEntryContentHeading,
|
|
181
|
+
"horizontalRule": cls._convertEntryContentHorizontalRule,
|
|
182
|
+
"listItem": cls._convertEntryContentListItem,
|
|
183
|
+
"orderedList": cls._convertEntryContentOrderedList,
|
|
184
|
+
"paragraph": cls._convertEntryContentParagraph,
|
|
185
|
+
"table": cls._convertEntryContentTable,
|
|
186
|
+
"tableCell": cls._convertEntryContentTableCell,
|
|
187
|
+
"tableRow": cls._convertEntryContentTableRow,
|
|
188
|
+
"taskList": cls._convertEntryContentTaskList,
|
|
189
|
+
"taskListItem": cls._convertEntryContentTaskListItem,
|
|
190
|
+
"text": cls._convertEntryContentText,
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
mapper = _typeMapper.get(item["type"], None)
|
|
194
|
+
if mapper:
|
|
195
|
+
return cast(_T, mapper(item))
|
|
196
|
+
|
|
197
|
+
return cast(_T, EntryContentItem(item))
|
|
198
|
+
|
|
199
|
+
@classmethod
|
|
200
|
+
def convertList(cls, items, fieldName: Optional[str] = None) -> list[_T]:
|
|
201
|
+
if not isinstance(items, list):
|
|
202
|
+
items = [items]
|
|
203
|
+
|
|
204
|
+
return [
|
|
205
|
+
cls.convert(item, fieldName=f"{fieldName}[{i}]" if fieldName else None)
|
|
206
|
+
for i, item in enumerate(items)
|
|
207
|
+
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
2
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
3
|
+
IEntryContentWithContent,
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EntryContentDocument(EntryContentItem, IEntryContentWithContent):
|
|
8
|
+
_type = "doc"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from LOGS.Entities.LabNotebookEntryContent.EntityAttribute import EntityAttribute
|
|
2
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
4
|
+
IEntryContentWithAttribute,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EntryContentEntity(
|
|
9
|
+
EntryContentItem,
|
|
10
|
+
IEntryContentWithAttribute[EntityAttribute],
|
|
11
|
+
):
|
|
12
|
+
_attrType = EntityAttribute
|
|
13
|
+
_type = "entity"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.EntityAttribute import EntityAttribute
|
|
4
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
5
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
6
|
+
IEntryContentWithAttribute,
|
|
7
|
+
)
|
|
8
|
+
from LOGS.Entities.LabNotebookEntryContent.TextMarkConverter import TextMarkConverter
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class EntryContentEntityMention(
|
|
12
|
+
EntryContentItem,
|
|
13
|
+
IEntryContentWithAttribute[EntityAttribute],
|
|
14
|
+
):
|
|
15
|
+
_attrType = EntityAttribute
|
|
16
|
+
_type = "entityMention"
|
|
17
|
+
|
|
18
|
+
_marks: Optional[List[IEntryContentWithAttribute]] = None
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def marks(self) -> Optional[List[IEntryContentWithAttribute]]:
|
|
22
|
+
return self._marks
|
|
23
|
+
|
|
24
|
+
@marks.setter
|
|
25
|
+
def marks(self, value):
|
|
26
|
+
self._marks = self.checkListAndConvertNullable(
|
|
27
|
+
value,
|
|
28
|
+
IEntryContentWithAttribute,
|
|
29
|
+
"marks",
|
|
30
|
+
converter=TextMarkConverter.convert,
|
|
31
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
4
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithContent import (
|
|
5
|
+
IEntryContentWithContent,
|
|
6
|
+
)
|
|
7
|
+
from LOGS.Entities.LabNotebookEntryContent.TextAttribute import TextAttribute
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HeadingAttribute(TextAttribute):
|
|
11
|
+
_level: Optional[int] = None
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def level(self) -> Optional[int]:
|
|
15
|
+
return self._level
|
|
16
|
+
|
|
17
|
+
@level.setter
|
|
18
|
+
def level(self, value):
|
|
19
|
+
self._level = self.checkAndConvertNullable(value, int, "level")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class EntryContentHeading(EntryContentItem, IEntryContentWithContent):
|
|
23
|
+
_type = "heading"
|
|
24
|
+
|
|
25
|
+
_attrs: Optional[HeadingAttribute] = None
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def attrs(self) -> Optional[HeadingAttribute]:
|
|
29
|
+
return self._attrs
|
|
30
|
+
|
|
31
|
+
@attrs.setter
|
|
32
|
+
def attrs(self, value):
|
|
33
|
+
self._attrs = self.checkAndConvertNullable(value, HeadingAttribute, "attrs")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from LOGS.Entities.LabNotebookEntryContent.BasicAttribute import BasicAttribute
|
|
2
|
+
from LOGS.Entities.LabNotebookEntryContent.EntryContentItem import EntryContentItem
|
|
3
|
+
from LOGS.Entities.LabNotebookEntryContent.IEntryContentWithAttribute import (
|
|
4
|
+
IEntryContentWithAttribute,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EntryContentHorizontalRule(
|
|
9
|
+
EntryContentItem, IEntryContentWithAttribute[BasicAttribute]
|
|
10
|
+
):
|
|
11
|
+
_attrType = BasicAttribute
|
|
12
|
+
_type = "horizontalRule"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Entity.SerializeableContent import SerializeableContent
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class EntryContentItem(SerializeableContent):
|
|
7
|
+
__type: str = "Unknown"
|
|
8
|
+
_type: Optional[str] = None
|
|
9
|
+
|
|
10
|
+
def fromDict(self, ref) -> None:
|
|
11
|
+
if isinstance(ref, dict):
|
|
12
|
+
if "type" not in ref or not ref["type"]:
|
|
13
|
+
raise ValueError(
|
|
14
|
+
f"EntryContentItem must contain a 'type' field. (Got '{self.truncString(str(ref))}')"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
super().fromDict(ref)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def type(self) -> str:
|
|
21
|
+
if type(self) == EntryContentItem:
|
|
22
|
+
return self.__type
|
|
23
|
+
|
|
24
|
+
if self._type:
|
|
25
|
+
return self._type
|
|
26
|
+
else:
|
|
27
|
+
raise ValueError(f"Field 'type' in class {type(self).__name__} is not set.")
|
|
28
|
+
|
|
29
|
+
@type.setter
|
|
30
|
+
def type(self, value):
|
|
31
|
+
if type(self) != EntryContentItem:
|
|
32
|
+
if self._type != value:
|
|
33
|
+
raise ValueError(
|
|
34
|
+
f"Field 'type' in class {type(self).__name__} is not mutable. (Got '{self.truncString(str(value))}' expected '{self._type}')"
|
|
35
|
+
)
|
|
36
|
+
return
|
|
37
|
+
self.__type = self.checkAndConvertNullable(value, str, "type")
|