logs-py 2.9.6__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 +96 -91
- 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 +274 -136
- 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/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 +47 -24
- 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 +8 -4
- 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 +62 -5
- LOGS/Interfaces/IHierarchyType.py +63 -0
- LOGS/Interfaces/IPermissionedEntity.py +29 -5
- LOGS/Interfaces/IProjectBased.py +1 -1
- LOGS/Interfaces/ITypedEntity.py +69 -12
- LOGS/Interfaces/IVersionedEntity.py +39 -0
- LOGS/LOGS.py +137 -46
- 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.6.dist-info → logs_py-3.0.0.dist-info}/METADATA +2 -1
- logs_py-3.0.0.dist-info/RECORD +263 -0
- 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.6.dist-info/RECORD +0 -183
- {logs_py-2.9.6.dist-info → logs_py-3.0.0.dist-info}/WHEEL +0 -0
- {logs_py-2.9.6.dist-info → logs_py-3.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Optional, Union
|
|
3
|
+
|
|
4
|
+
from LOGS.Entity.SerializeableContent import SerializeableClass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ParameterType(Enum):
|
|
8
|
+
Integer = "Integer"
|
|
9
|
+
String = "String"
|
|
10
|
+
Boolean = "Boolean"
|
|
11
|
+
Float = "Float"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IConverterParameter(SerializeableClass):
|
|
15
|
+
name: Optional[str] = None
|
|
16
|
+
id: Optional[str] = None
|
|
17
|
+
description: Optional[str] = None
|
|
18
|
+
required: Optional[bool] = None
|
|
19
|
+
hasDefault: Optional[bool] = None
|
|
20
|
+
identifier: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def TypeMapper(cls, t: Union[ParameterType, str]):
|
|
24
|
+
if t == ParameterType.Integer:
|
|
25
|
+
return int
|
|
26
|
+
if t == ParameterType.String:
|
|
27
|
+
return str
|
|
28
|
+
if t == ParameterType.Boolean:
|
|
29
|
+
return bool
|
|
30
|
+
if t == ParameterType.Float:
|
|
31
|
+
return float
|
|
32
|
+
raise Exception("Unknown parameter type '%s'" % t)
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def GetParameterFromDict(cls, data: dict):
|
|
36
|
+
if not isinstance(data, dict) or "type" not in data:
|
|
37
|
+
raise Exception(f"Export parameter type not specified.")
|
|
38
|
+
|
|
39
|
+
type = data["type"]
|
|
40
|
+
if type not in ParameterType.__members__:
|
|
41
|
+
raise Exception(
|
|
42
|
+
f"Unknown export parameter type '{type}' not found in parameter data"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
type = ParameterType.__members__[type]
|
|
46
|
+
|
|
47
|
+
if type == ParameterType.Integer:
|
|
48
|
+
return ConverterIntegerParameter(data)
|
|
49
|
+
if type == ParameterType.String:
|
|
50
|
+
return ConverterStringParameter(data)
|
|
51
|
+
if type == ParameterType.Boolean:
|
|
52
|
+
return ConverterBooleanParameter(data)
|
|
53
|
+
if type == ParameterType.Float:
|
|
54
|
+
return ConverterFloatParameter(data)
|
|
55
|
+
|
|
56
|
+
raise Exception(
|
|
57
|
+
f"Unknown export parameter type '{type}' not found in parameter data"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def type(self) -> ParameterType:
|
|
62
|
+
raise NotImplementedError(
|
|
63
|
+
f"{type(self).__name__} is an abstract class. Please implement the 'type' property."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ConverterIntegerParameter(IConverterParameter):
|
|
68
|
+
@property
|
|
69
|
+
def type(self) -> ParameterType:
|
|
70
|
+
return ParameterType.Integer
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class ConverterStringParameter(IConverterParameter):
|
|
74
|
+
@property
|
|
75
|
+
def type(self) -> ParameterType:
|
|
76
|
+
return ParameterType.String
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ConverterBooleanParameter(IConverterParameter):
|
|
80
|
+
@property
|
|
81
|
+
def type(self) -> ParameterType:
|
|
82
|
+
return ParameterType.Boolean
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ConverterFloatParameter(IConverterParameter):
|
|
86
|
+
@property
|
|
87
|
+
def type(self) -> ParameterType:
|
|
88
|
+
return ParameterType.Float
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from typing import Any, Dict, Optional
|
|
2
|
+
|
|
3
|
+
from LOGS.Auxiliary.Tools import Tools
|
|
4
|
+
from LOGS.Entity.SerializeableContent import SerializeableClass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ExportParamters(SerializeableClass):
|
|
8
|
+
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
ref=None,
|
|
12
|
+
types: Optional[Dict[str, type]] = None,
|
|
13
|
+
):
|
|
14
|
+
self._lock = False
|
|
15
|
+
if types is not None:
|
|
16
|
+
if not isinstance(types, dict):
|
|
17
|
+
raise Exception("type must be a dictionary")
|
|
18
|
+
for k, v in types.items():
|
|
19
|
+
if not isinstance(v, type):
|
|
20
|
+
raise Exception(
|
|
21
|
+
f"Invalid type for key '{k}'. (Expected '{type.__name__}' got '{type(v).__name__}')"
|
|
22
|
+
)
|
|
23
|
+
else:
|
|
24
|
+
types = {}
|
|
25
|
+
|
|
26
|
+
self._typeMapping: Dict[str, type] = {}
|
|
27
|
+
if isinstance(ref, dict):
|
|
28
|
+
if "_parentId" in ref:
|
|
29
|
+
self._parentId: Optional[str] = str(ref["_parentId"])
|
|
30
|
+
del ref["_parentId"]
|
|
31
|
+
else:
|
|
32
|
+
self._parentId = None
|
|
33
|
+
|
|
34
|
+
self._includeNone = True
|
|
35
|
+
for k in ref.keys():
|
|
36
|
+
setattr(self, k, ref[k])
|
|
37
|
+
if k in types:
|
|
38
|
+
self._typeMapping[k] = types[k]
|
|
39
|
+
super().__init__(ref)
|
|
40
|
+
self._lock = True
|
|
41
|
+
|
|
42
|
+
def fromDict(self, ref) -> None:
|
|
43
|
+
if getattr(self, "_lock", False):
|
|
44
|
+
if isinstance(ref, dict):
|
|
45
|
+
if "parameters" in ref and isinstance(ref["parameters"], list):
|
|
46
|
+
for p in ref["parameters"]:
|
|
47
|
+
if "id" in p and "value" in p:
|
|
48
|
+
setattr(self, p["id"], p["value"])
|
|
49
|
+
for k, v in ref.items():
|
|
50
|
+
setattr(self, k, v)
|
|
51
|
+
return super().fromDict(ref)
|
|
52
|
+
|
|
53
|
+
def toDict(self) -> Dict[str, Any]:
|
|
54
|
+
l = [
|
|
55
|
+
{"id": k, "value": getattr(self, k)}
|
|
56
|
+
for k in self.__dict__
|
|
57
|
+
if k[0] != "_" and getattr(self, k) is not None
|
|
58
|
+
]
|
|
59
|
+
if l:
|
|
60
|
+
return {"parameters": l}
|
|
61
|
+
return {}
|
|
62
|
+
|
|
63
|
+
def __repr__(self):
|
|
64
|
+
fields = [
|
|
65
|
+
f"{k}{':' + self._typeMapping[k].__name__ if k in self._typeMapping else ''}={v}"
|
|
66
|
+
for k, v in self.toDict().items()
|
|
67
|
+
]
|
|
68
|
+
return f'{self.identifier}({", ".join(fields)})'
|
|
69
|
+
|
|
70
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
71
|
+
if getattr(self, "_lock", False):
|
|
72
|
+
if name not in self._typeMapping:
|
|
73
|
+
raise Exception(f"Unknown field '{self.identifier}.{name}'")
|
|
74
|
+
|
|
75
|
+
if name in self._typeMapping:
|
|
76
|
+
value = Tools.checkAndConvert(
|
|
77
|
+
value,
|
|
78
|
+
self._typeMapping[name],
|
|
79
|
+
f"{self.identifier}.{name}",
|
|
80
|
+
allowNone=True,
|
|
81
|
+
)
|
|
82
|
+
return super().__setattr__(name, value)
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def identifier(self):
|
|
86
|
+
return f"{self.__class__.__name__}{'<' + self._parentId + '>' if self._parentId else ''}"
|
|
87
|
+
|
|
88
|
+
def __str__(self):
|
|
89
|
+
return self.__repr__()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This package is written for the LOGS Repository.
|
|
3
|
+
|
|
4
|
+
It's objects can be used to write your own dataset parser.
|
|
5
|
+
|
|
6
|
+
License:
|
|
7
|
+
Permission to use this libraray and all of its contents is
|
|
8
|
+
strictly permitted to the Signals Company.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .Conversion import *
|
|
12
|
+
from .Converter import *
|
|
13
|
+
from .ConverterParameter import *
|
LOGS/Entities/Bridge.py
CHANGED
|
@@ -8,16 +8,19 @@ from LOGS.Entities.BridgeRelations import BridgeRelations
|
|
|
8
8
|
from LOGS.Entities.BridgeType import BridgeType
|
|
9
9
|
from LOGS.Entity.EntityWithIntId import IEntityWithIntId
|
|
10
10
|
from LOGS.Interfaces.INamedEntity import INamedEntity
|
|
11
|
-
from LOGS.Interfaces.IPermissionedEntity import
|
|
11
|
+
from LOGS.Interfaces.IPermissionedEntity import GenericPermissionEntity
|
|
12
12
|
from LOGS.Interfaces.IRelatedEntity import IRelatedEntity
|
|
13
13
|
from LOGS.LOGSConnection import LOGSConnection
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@Endpoint("bridges")
|
|
17
17
|
class Bridge(
|
|
18
|
-
IEntityWithIntId,
|
|
18
|
+
IEntityWithIntId,
|
|
19
|
+
INamedEntity,
|
|
20
|
+
IRelatedEntity[BridgeRelations],
|
|
21
|
+
GenericPermissionEntity,
|
|
19
22
|
):
|
|
20
|
-
_relationType =
|
|
23
|
+
_relationType = BridgeRelations
|
|
21
24
|
|
|
22
25
|
_type: Optional[BridgeType]
|
|
23
26
|
_hostname: Optional[str]
|
LOGS/Entities/CustomField.py
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
from
|
|
2
|
-
from typing import List, Optional
|
|
3
|
-
|
|
4
|
-
from regex import Regex
|
|
1
|
+
from typing import TYPE_CHECKING, List, Optional
|
|
5
2
|
|
|
6
3
|
from LOGS.Auxiliary.Decorators import Endpoint
|
|
7
|
-
from LOGS.
|
|
8
|
-
from LOGS.
|
|
4
|
+
from LOGS.Auxiliary.MinimalModelGenerator import MinimalFromList
|
|
5
|
+
from LOGS.Entities.CustomFieldModels import CustomFieldDataType
|
|
6
|
+
from LOGS.Entities.CustomFieldRelations import CustomFieldRelations
|
|
7
|
+
from LOGS.Entities.ILiterarTypedEntity import ILiterarTypedEntity
|
|
8
|
+
from LOGS.Entity.EntityWithIntId import IEntityWithIntId
|
|
9
|
+
from LOGS.Interfaces.ICreationRecord import ICreationRecord
|
|
10
|
+
from LOGS.Interfaces.IModificationRecord import IModificationRecord
|
|
9
11
|
from LOGS.Interfaces.INamedEntity import INamedEntity
|
|
10
12
|
from LOGS.Interfaces.IOwnedEntity import IOwnedEntity
|
|
13
|
+
from LOGS.Interfaces.IPermissionedEntity import GenericPermissionEntity
|
|
14
|
+
from LOGS.Interfaces.IRelatedEntity import IRelatedEntity
|
|
15
|
+
from LOGS.Interfaces.IUniqueEntity import IUniqueEntity
|
|
11
16
|
from LOGS.LOGSConnection import LOGSConnection
|
|
12
17
|
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from LOGS.Entities.CustomTypeMinimal import CustomTypeMinimal
|
|
20
|
+
|
|
13
21
|
|
|
14
22
|
@Endpoint("custom_fields")
|
|
15
23
|
class CustomField(
|
|
16
|
-
|
|
24
|
+
IEntityWithIntId,
|
|
17
25
|
IOwnedEntity,
|
|
18
26
|
INamedEntity,
|
|
27
|
+
IUniqueEntity,
|
|
28
|
+
ICreationRecord,
|
|
29
|
+
IModificationRecord,
|
|
30
|
+
IRelatedEntity[CustomFieldRelations],
|
|
31
|
+
ILiterarTypedEntity,
|
|
32
|
+
GenericPermissionEntity,
|
|
19
33
|
):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
_relationType = CustomFieldRelations
|
|
35
|
+
_type = "CustomField"
|
|
36
|
+
|
|
37
|
+
_customTypeConstraint: Optional[List["CustomTypeMinimal"]] = None
|
|
38
|
+
_dataType: Optional[CustomFieldDataType] = None
|
|
39
|
+
_defaultValue: Optional[str] = None
|
|
40
|
+
_description: Optional[str] = None
|
|
41
|
+
_enumOptions: Optional[List[str]] = None
|
|
42
|
+
_enumOptionsFromValues: Optional[bool] = None
|
|
43
|
+
_placeholder: Optional[str] = None
|
|
44
|
+
_readOnly: Optional[bool] = None
|
|
45
|
+
_required: Optional[bool] = None
|
|
46
|
+
_showAsTextArea: Optional[bool] = None
|
|
47
|
+
_validationMessage: Optional[str] = None
|
|
48
|
+
_validationRegexp: Optional[str] = None
|
|
33
49
|
|
|
34
50
|
def __init__(
|
|
35
51
|
self,
|
|
36
52
|
ref=None,
|
|
37
|
-
id: Optional[
|
|
53
|
+
id: Optional[int] = None,
|
|
38
54
|
connection: Optional[LOGSConnection] = None,
|
|
39
|
-
name: str = "",
|
|
40
55
|
):
|
|
41
|
-
self._name = name
|
|
42
|
-
if id is None:
|
|
43
|
-
id = self._idFromName(name)
|
|
44
|
-
self._createdAt = None
|
|
45
|
-
self._widget = None
|
|
46
|
-
self._type = None
|
|
47
|
-
self._description = None
|
|
48
|
-
self._defaultValue = None
|
|
49
|
-
self._isReadOnly = None
|
|
50
|
-
self._isRequired = None
|
|
51
|
-
self._isMulti = None
|
|
52
|
-
self._validationRegexp = None
|
|
53
|
-
self._validationMessage = None
|
|
54
|
-
self._enumOptions = None
|
|
55
|
-
|
|
56
56
|
if ref != None and isinstance(ref, (str, int, float)):
|
|
57
57
|
ref = {"text": str(ref)}
|
|
58
58
|
|
|
@@ -66,34 +66,6 @@ class CustomField(
|
|
|
66
66
|
|
|
67
67
|
super().fromDict(ref=ref)
|
|
68
68
|
|
|
69
|
-
@classmethod
|
|
70
|
-
def _idFromName(cls, name):
|
|
71
|
-
return cls._alphanumeric.sub("_", name).lower()
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def createdAt(self) -> Optional[datetime]:
|
|
75
|
-
return self._createdAt
|
|
76
|
-
|
|
77
|
-
@createdAt.setter
|
|
78
|
-
def createdAt(self, value):
|
|
79
|
-
self._createdAt = self.checkAndConvertNullable(value, datetime, "createdAt")
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def widget(self) -> Optional[CustomFieldTypes]:
|
|
83
|
-
return self._widget
|
|
84
|
-
|
|
85
|
-
@widget.setter
|
|
86
|
-
def widget(self, value):
|
|
87
|
-
self._widget = self.checkAndConvertNullable(value, CustomFieldTypes, "widget")
|
|
88
|
-
|
|
89
|
-
@property
|
|
90
|
-
def type(self) -> Optional[CustomFieldDataTypes]:
|
|
91
|
-
return self._type
|
|
92
|
-
|
|
93
|
-
@type.setter
|
|
94
|
-
def type(self, value):
|
|
95
|
-
self._type = self.checkAndConvertNullable(value, CustomFieldDataTypes, "type")
|
|
96
|
-
|
|
97
69
|
@property
|
|
98
70
|
def description(self) -> Optional[str]:
|
|
99
71
|
return self._description
|
|
@@ -111,28 +83,20 @@ class CustomField(
|
|
|
111
83
|
self._defaultValue = self.checkAndConvertNullable(value, str, "defaultValue")
|
|
112
84
|
|
|
113
85
|
@property
|
|
114
|
-
def
|
|
115
|
-
return self.
|
|
86
|
+
def readOnly(self) -> Optional[bool]:
|
|
87
|
+
return self._readOnly
|
|
116
88
|
|
|
117
|
-
@
|
|
118
|
-
def
|
|
119
|
-
self.
|
|
89
|
+
@readOnly.setter
|
|
90
|
+
def readOnly(self, value):
|
|
91
|
+
self._readOnly = self.checkAndConvertNullable(value, bool, "readOnly")
|
|
120
92
|
|
|
121
93
|
@property
|
|
122
|
-
def
|
|
123
|
-
return self.
|
|
94
|
+
def required(self) -> Optional[bool]:
|
|
95
|
+
return self._required
|
|
124
96
|
|
|
125
|
-
@
|
|
126
|
-
def
|
|
127
|
-
self.
|
|
128
|
-
|
|
129
|
-
@property
|
|
130
|
-
def isMulti(self) -> Optional[bool]:
|
|
131
|
-
return self._isMulti
|
|
132
|
-
|
|
133
|
-
@isMulti.setter
|
|
134
|
-
def isMulti(self, value):
|
|
135
|
-
self._isMulti = self.checkAndConvertNullable(value, bool, "isMulti")
|
|
97
|
+
@required.setter
|
|
98
|
+
def required(self, value):
|
|
99
|
+
self._required = self.checkAndConvertNullable(value, bool, "required")
|
|
136
100
|
|
|
137
101
|
@property
|
|
138
102
|
def validationRegexp(self) -> Optional[str]:
|
|
@@ -160,14 +124,55 @@ class CustomField(
|
|
|
160
124
|
|
|
161
125
|
@enumOptions.setter
|
|
162
126
|
def enumOptions(self, value):
|
|
127
|
+
if value == None:
|
|
128
|
+
self._enumOptions = None
|
|
129
|
+
return
|
|
163
130
|
self._enumOptions = self.checkListAndConvertNullable(value, str, "enumOptions")
|
|
164
131
|
|
|
165
132
|
@property
|
|
166
|
-
def
|
|
167
|
-
return self.
|
|
168
|
-
|
|
169
|
-
@
|
|
170
|
-
def
|
|
171
|
-
self.
|
|
172
|
-
|
|
173
|
-
|
|
133
|
+
def customTypeConstraint(self) -> Optional[List["CustomTypeMinimal"]]:
|
|
134
|
+
return self._customTypeConstraint
|
|
135
|
+
|
|
136
|
+
@customTypeConstraint.setter
|
|
137
|
+
def customTypeConstraint(self, value):
|
|
138
|
+
self._customTypeConstraint = MinimalFromList(
|
|
139
|
+
value, "CustomTypeMinimal", "customTypeConstraint"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def dataType(self) -> Optional[CustomFieldDataType]:
|
|
144
|
+
return self._dataType
|
|
145
|
+
|
|
146
|
+
@dataType.setter
|
|
147
|
+
def dataType(self, value):
|
|
148
|
+
self._dataType = self.checkAndConvertNullable(
|
|
149
|
+
value, CustomFieldDataType, "dataType"
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def enumOptionsFromValues(self) -> Optional[bool]:
|
|
154
|
+
return self._enumOptionsFromValues
|
|
155
|
+
|
|
156
|
+
@enumOptionsFromValues.setter
|
|
157
|
+
def enumOptionsFromValues(self, value):
|
|
158
|
+
self._enumOptionsFromValues = self.checkAndConvertNullable(
|
|
159
|
+
value, bool, "enumOptionsFromValues"
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def placeholder(self) -> Optional[str]:
|
|
164
|
+
return self._placeholder
|
|
165
|
+
|
|
166
|
+
@placeholder.setter
|
|
167
|
+
def placeholder(self, value):
|
|
168
|
+
self._placeholder = self.checkAndConvertNullable(value, str, "placeholder")
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def showAsTextArea(self) -> Optional[bool]:
|
|
172
|
+
return self._showAsTextArea
|
|
173
|
+
|
|
174
|
+
@showAsTextArea.setter
|
|
175
|
+
def showAsTextArea(self, value):
|
|
176
|
+
self._showAsTextArea = self.checkAndConvertNullable(
|
|
177
|
+
value, bool, "showAsTextArea"
|
|
178
|
+
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CustomFieldDataType(Enum):
|
|
5
|
+
String = "String"
|
|
6
|
+
StringArray = "StringArray"
|
|
7
|
+
Integer = "Integer"
|
|
8
|
+
IntegerArray = "IntegerArray"
|
|
9
|
+
Float = "Float"
|
|
10
|
+
FloatArray = "FloatArray"
|
|
11
|
+
Boolean = "Boolean"
|
|
12
|
+
Date = "Date"
|
|
13
|
+
DateArray = "DateArray"
|
|
14
|
+
DateTime = "DateTime"
|
|
15
|
+
DateTimeArray = "DateTimeArray"
|
|
16
|
+
Time = "Time"
|
|
17
|
+
TimeArray = "TimeArray"
|
|
18
|
+
DateTimeRange = "DateTimeRange"
|
|
19
|
+
TimeRange = "TimeRange"
|
|
20
|
+
Dataset = "Dataset"
|
|
21
|
+
DatasetArray = "DatasetArray"
|
|
22
|
+
Sample = "Sample"
|
|
23
|
+
SampleArray = "SampleArray"
|
|
24
|
+
Project = "Project"
|
|
25
|
+
ProjectArray = "ProjectArray"
|
|
26
|
+
Organization = "Organization"
|
|
27
|
+
OrganizationArray = "OrganizationArray"
|
|
28
|
+
Person = "Person"
|
|
29
|
+
PersonArray = "PersonArray"
|
|
30
|
+
Method = "Method"
|
|
31
|
+
MethodArray = "MethodArray"
|
|
32
|
+
Instrument = "Instrument"
|
|
33
|
+
InstrumentArray = "InstrumentArray"
|
|
34
|
+
SharedContent = "SharedContent"
|
|
35
|
+
SharedContentArray = "SharedContentArray"
|
|
36
|
+
LabNotebook = "LabNotebook"
|
|
37
|
+
LabNotebookArray = "LabNotebookArray"
|
|
38
|
+
LabNotebookExperiment = "LabNotebookExperiment"
|
|
39
|
+
LabNotebookExperimentArray = "LabNotebookExperimentArray"
|
|
40
|
+
LabNotebookEntry = "LabNotebookEntry"
|
|
41
|
+
LabNotebookEntryArray = "LabNotebookEntryArray"
|
|
42
|
+
ViewableEntity = "ViewableEntity"
|
|
43
|
+
Inventory = "Inventory"
|
|
44
|
+
InventoryArray = "InventoryArray"
|
|
45
|
+
EntityBarCode = "EntityBarCode"
|
|
46
|
+
Url = "Url"
|
|
47
|
+
UrlArray = "UrlArray"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CustomFieldValuesSearchPredicate(Enum):
|
|
51
|
+
AND = "AND"
|
|
52
|
+
OR = "OR"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class CustomFieldValueType(Enum):
|
|
56
|
+
CustomField = "CustomField"
|
|
57
|
+
CustomTypeSection = "CustomTypeSection"
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
-
from datetime import datetime
|
|
3
2
|
from enum import Enum
|
|
4
|
-
from typing import List, Optional
|
|
3
|
+
from typing import Any, List, Optional
|
|
5
4
|
|
|
6
|
-
from LOGS.Entities.
|
|
5
|
+
from LOGS.Entities.CustomFieldModels import (
|
|
6
|
+
CustomFieldDataType,
|
|
7
|
+
CustomFieldValuesSearchPredicate,
|
|
8
|
+
)
|
|
7
9
|
from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
|
|
10
|
+
from LOGS.Interfaces.ICreationRecord import ICreationRecordRequest
|
|
11
|
+
from LOGS.Interfaces.IModificationRecord import IModificationRecordRequest
|
|
8
12
|
from LOGS.Interfaces.INamedEntity import INamedEntityRequest
|
|
9
13
|
from LOGS.Interfaces.IOwnedEntity import IOwnedEntityRequest
|
|
10
14
|
from LOGS.Interfaces.IPaginationRequest import IPaginationRequest
|
|
15
|
+
from LOGS.Interfaces.IPermissionedEntity import IPermissionedEntityRequest
|
|
16
|
+
from LOGS.Interfaces.IRelationRequest import IRelationRequest
|
|
11
17
|
|
|
12
18
|
|
|
13
19
|
class CustomFieldOrder(Enum):
|
|
@@ -15,26 +21,48 @@ class CustomFieldOrder(Enum):
|
|
|
15
21
|
ID_DESC = "ID_DESC"
|
|
16
22
|
NAME_ASC = "NAME_ASC"
|
|
17
23
|
NAME_DESC = "NAME_DESC"
|
|
18
|
-
TYPE_ASC = "TYPE_ASC"
|
|
19
|
-
TYPE_DESC = "TYPE_DESC"
|
|
20
|
-
WIDGET_ASC = "WIDGET_ASC"
|
|
21
|
-
WIDGET_DESC = "WIDGET_DESC"
|
|
22
|
-
OWNER_ASC = "OWNER_ASC"
|
|
23
|
-
OWNER_DESC = "OWNER_DESC"
|
|
24
24
|
CREATED_ON_ASC = "CREATED_ON_ASC"
|
|
25
25
|
CREATED_ON_DESC = "CREATED_ON_DESC"
|
|
26
|
+
CREATED_BY_ASC = "CREATED_BY_ASC"
|
|
27
|
+
CREATED_BY_DESC = "CREATED_BY_DESC"
|
|
28
|
+
MODIFIED_ON_ASC = "MODIFIED_ON_ASC"
|
|
29
|
+
MODIFIED_ON_DESC = "MODIFIED_ON_DESC"
|
|
30
|
+
MODIFIED_BY_ASC = "MODIFIED_BY_ASC"
|
|
31
|
+
MODIFIED_BY_DESC = "MODIFIED_BY_DESC"
|
|
32
|
+
DATATYPE_ASC = "DATATYPE_ASC"
|
|
33
|
+
DATATYPE_DESC = "DATATYPE_DESC"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class CustomFieldValuesSearchParameters:
|
|
38
|
+
values: Optional[List[Any]] = None
|
|
39
|
+
dataType: Optional[CustomFieldDataType] = None
|
|
40
|
+
customFieldIds: Optional[List[int]] = None
|
|
41
|
+
sampleIds: Optional[List[int]] = None
|
|
42
|
+
datasetIds: Optional[List[int]] = None
|
|
43
|
+
projectIds: Optional[List[int]] = None
|
|
44
|
+
personIds: Optional[List[int]] = None
|
|
45
|
+
inventoryIds: Optional[List[int]] = None
|
|
46
|
+
facilityIds: Optional[List[int]] = None
|
|
47
|
+
predicate: Optional[CustomFieldValuesSearchPredicate] = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class ICustomFieldValuesSearchRequest:
|
|
52
|
+
customFieldValues: Optional[List[CustomFieldValuesSearchParameters]] = None
|
|
26
53
|
|
|
27
54
|
|
|
28
55
|
@dataclass
|
|
29
56
|
class CustomFieldRequestParameter(
|
|
30
57
|
EntityRequestParameter[CustomFieldOrder],
|
|
31
58
|
IPaginationRequest,
|
|
59
|
+
IRelationRequest,
|
|
60
|
+
IPermissionedEntityRequest,
|
|
61
|
+
ICreationRecordRequest,
|
|
62
|
+
IModificationRecordRequest,
|
|
63
|
+
ICustomFieldValuesSearchRequest,
|
|
32
64
|
IOwnedEntityRequest,
|
|
33
65
|
INamedEntityRequest,
|
|
34
66
|
):
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
creationDateFrom: Optional[datetime] = None
|
|
38
|
-
creationDateTo: Optional[datetime] = None
|
|
39
|
-
widgets: Optional[List[CustomFieldTypes]] = None
|
|
40
|
-
properties: Optional[List[CustomFieldPropertyFilters]] = None
|
|
67
|
+
dataTypes: Optional[List[CustomFieldDataType]] = None
|
|
68
|
+
customFieldValues: Optional[List[CustomFieldValuesSearchParameters]] = None
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Any, Optional, Sequence, Union, cast
|
|
2
|
+
|
|
3
|
+
from LOGS.Auxiliary.Exceptions import IllegalFieldValueException
|
|
4
|
+
from LOGS.Auxiliary.Tools import Tools
|
|
5
|
+
from LOGS.Entities.CustomFieldModels import CustomFieldDataType, CustomFieldValueType
|
|
6
|
+
from LOGS.Entities.CustomFieldValueConverter import CustomFieldValueConverter
|
|
7
|
+
from LOGS.Entity.SerializeableContent import SerializeableContent
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ICustomValue(SerializeableContent):
|
|
14
|
+
_name: Optional[str] = None
|
|
15
|
+
_type: CustomFieldValueType = cast(CustomFieldValueType, None)
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def name(self) -> Optional[str]:
|
|
19
|
+
return self._name
|
|
20
|
+
|
|
21
|
+
@name.setter
|
|
22
|
+
def name(self, value):
|
|
23
|
+
self._name = self.checkAndConvertNullable(value, str, "name")
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def type(self) -> CustomFieldValueType:
|
|
27
|
+
return self._type
|
|
28
|
+
|
|
29
|
+
@type.setter
|
|
30
|
+
def type(self, value):
|
|
31
|
+
value = self.checkAndConvert(value, CustomFieldValueType, "type")
|
|
32
|
+
if value != self._type:
|
|
33
|
+
raise IllegalFieldValueException(
|
|
34
|
+
self, "type", value, f"Only value '{self._type}' allowed."
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CustomFieldValue(ICustomValue):
|
|
39
|
+
_type: CustomFieldValueType = CustomFieldValueType.CustomField
|
|
40
|
+
|
|
41
|
+
_id: Optional[int] = None
|
|
42
|
+
_dataType: Optional[CustomFieldDataType] = None
|
|
43
|
+
_value: Optional[Any] = None
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def id(self) -> Optional[int]:
|
|
47
|
+
return self._id
|
|
48
|
+
|
|
49
|
+
@id.setter
|
|
50
|
+
def id(self, value):
|
|
51
|
+
self._id = self.checkAndConvertNullable(value, int, "id")
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def dataType(self) -> Optional[CustomFieldDataType]:
|
|
55
|
+
return self._dataType
|
|
56
|
+
|
|
57
|
+
@dataType.setter
|
|
58
|
+
def dataType(self, value):
|
|
59
|
+
self._dataType = self.checkAndConvertNullable(
|
|
60
|
+
value, CustomFieldDataType, "dataType"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def value(self) -> Optional[Any]:
|
|
65
|
+
return self._value
|
|
66
|
+
|
|
67
|
+
@value.setter
|
|
68
|
+
def value(self, value):
|
|
69
|
+
self._value = value
|
|
70
|
+
|
|
71
|
+
def __str__(self):
|
|
72
|
+
return Tools.ObjectToString(self)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CustomSectionValue(ICustomValue):
|
|
76
|
+
_type: CustomFieldValueType = CustomFieldValueType.CustomTypeSection
|
|
77
|
+
|
|
78
|
+
_content: Optional[Sequence[Union[CustomFieldValue, "CustomSectionValue"]]] = None
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def content(
|
|
82
|
+
self,
|
|
83
|
+
) -> Optional[Sequence[Union[CustomFieldValue, "CustomSectionValue"]]]:
|
|
84
|
+
return self._content
|
|
85
|
+
|
|
86
|
+
@content.setter
|
|
87
|
+
def content(self, value):
|
|
88
|
+
self._content = CustomFieldValueConverter.convert(value)
|