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.

Files changed (148) hide show
  1. LOGS/Auxiliary/DateTimeConverter.py +11 -1
  2. LOGS/Auxiliary/Exceptions.py +40 -4
  3. LOGS/Auxiliary/LOGSErrorResponse.py +4 -1
  4. LOGS/Auxiliary/MinimalModelGenerator.py +88 -28
  5. LOGS/Auxiliary/Tools.py +11 -0
  6. LOGS/Converter/Conversion.py +248 -0
  7. LOGS/Converter/Converter.py +96 -0
  8. LOGS/Converter/ConverterParameter.py +88 -0
  9. LOGS/Converter/ExportParamters.py +89 -0
  10. LOGS/Converter/__init__.py +13 -0
  11. LOGS/Entities/Bridge.py +6 -3
  12. LOGS/Entities/CustomField.py +98 -93
  13. LOGS/Entities/CustomFieldModels.py +57 -0
  14. LOGS/Entities/CustomFieldRelations.py +10 -0
  15. LOGS/Entities/CustomFieldRequestParameter.py +43 -15
  16. LOGS/Entities/CustomFieldValue.py +88 -0
  17. LOGS/Entities/CustomFieldValueConverter.py +66 -0
  18. LOGS/Entities/CustomType.py +187 -0
  19. LOGS/Entities/CustomTypeEntityType.py +11 -0
  20. LOGS/Entities/CustomTypeMinimal.py +8 -0
  21. LOGS/Entities/CustomTypeRelations.py +59 -0
  22. LOGS/Entities/CustomTypeRequestParameter.py +61 -0
  23. LOGS/Entities/CustomTypeSection.py +39 -0
  24. LOGS/Entities/CustomTypes.py +12 -0
  25. LOGS/Entities/DataSource.py +28 -14
  26. LOGS/Entities/Dataset.py +276 -138
  27. LOGS/Entities/DatasetCreator.py +23 -72
  28. LOGS/Entities/DatasetInfo.py +23 -2
  29. LOGS/Entities/DatasetModels.py +31 -0
  30. LOGS/Entities/DatasetRequestParameter.py +45 -32
  31. LOGS/Entities/Datatrack.py +74 -30
  32. LOGS/Entities/DatatrackFormattedTable.py +25 -0
  33. LOGS/Entities/DatatrackGeneric.py +34 -0
  34. LOGS/Entities/DatatrackImage.py +25 -0
  35. LOGS/Entities/DatatrackNumericArray.py +9 -39
  36. LOGS/Entities/DatatrackNumericMatrix.py +86 -0
  37. LOGS/Entities/DocumentRequestParameter.py +2 -2
  38. LOGS/Entities/EntitiesRequestParameter.py +2 -2
  39. LOGS/Entities/Experiment.py +3 -3
  40. LOGS/Entities/FileExcludePattern.py +8 -0
  41. LOGS/Entities/FormatFormat.py +22 -1
  42. LOGS/Entities/FormatFormatRequestParameter.py +2 -1
  43. LOGS/Entities/FormatFormats.py +1 -1
  44. LOGS/Entities/FormatMethod.py +2 -2
  45. LOGS/Entities/FormattedTable/DatatypeFormattedTable.py +135 -0
  46. LOGS/Entities/FormattedTable/DatatypeFormattedTableCell.py +108 -0
  47. LOGS/Entities/FormattedTable/DatatypeFormattedTableSettings.py +11 -0
  48. LOGS/Entities/FormattedTable/__init__.py +9 -0
  49. LOGS/Entities/ILiterarTypedEntity.py +19 -0
  50. LOGS/Entities/Instrument.py +3 -3
  51. LOGS/Entities/Inventories.py +12 -0
  52. LOGS/Entities/Inventory.py +95 -0
  53. LOGS/Entities/InventoryMinimal.py +20 -0
  54. LOGS/Entities/InventoryRelations.py +23 -0
  55. LOGS/Entities/InventoryRequestParameter.py +53 -0
  56. LOGS/Entities/LabNotebook.py +37 -0
  57. LOGS/Entities/LabNotebookEntry.py +50 -27
  58. LOGS/Entities/LabNotebookEntryContent/BasicAttribute.py +15 -0
  59. LOGS/Entities/LabNotebookEntryContent/EntityAttribute.py +85 -0
  60. LOGS/Entities/LabNotebookEntryContent/EntryContentBlockquote.py +13 -0
  61. LOGS/Entities/LabNotebookEntryContent/EntryContentBulletList.py +17 -0
  62. LOGS/Entities/LabNotebookEntryContent/EntryContentCallout.py +40 -0
  63. LOGS/Entities/LabNotebookEntryContent/EntryContentContentPlaceholderNode.py +31 -0
  64. LOGS/Entities/LabNotebookEntryContent/EntryContentConverter.py +207 -0
  65. LOGS/Entities/LabNotebookEntryContent/EntryContentDocument.py +8 -0
  66. LOGS/Entities/LabNotebookEntryContent/EntryContentEntity.py +13 -0
  67. LOGS/Entities/LabNotebookEntryContent/EntryContentEntityMention.py +31 -0
  68. LOGS/Entities/LabNotebookEntryContent/EntryContentHeading.py +33 -0
  69. LOGS/Entities/LabNotebookEntryContent/EntryContentHorizontalRule.py +12 -0
  70. LOGS/Entities/LabNotebookEntryContent/EntryContentItem.py +37 -0
  71. LOGS/Entities/LabNotebookEntryContent/EntryContentListItem.py +49 -0
  72. LOGS/Entities/LabNotebookEntryContent/EntryContentOrderedList.py +31 -0
  73. LOGS/Entities/LabNotebookEntryContent/EntryContentParagraph.py +13 -0
  74. LOGS/Entities/LabNotebookEntryContent/EntryContentTable.py +17 -0
  75. LOGS/Entities/LabNotebookEntryContent/EntryContentTableCell.py +40 -0
  76. LOGS/Entities/LabNotebookEntryContent/EntryContentTableRow.py +8 -0
  77. LOGS/Entities/LabNotebookEntryContent/EntryContentTaskList.py +17 -0
  78. LOGS/Entities/LabNotebookEntryContent/EntryContentTaskListItem.py +31 -0
  79. LOGS/Entities/LabNotebookEntryContent/EntryContentText.py +33 -0
  80. LOGS/Entities/LabNotebookEntryContent/IEntryContentWithAttribute.py +23 -0
  81. LOGS/Entities/LabNotebookEntryContent/IEntryContentWithContent.py +38 -0
  82. LOGS/Entities/LabNotebookEntryContent/IEntryContentWithTextAttribute.py +16 -0
  83. LOGS/Entities/LabNotebookEntryContent/TextAttribute.py +46 -0
  84. LOGS/Entities/LabNotebookEntryContent/TextMarkAtributes.py +64 -0
  85. LOGS/Entities/LabNotebookEntryContent/TextMarkConverter.py +45 -0
  86. LOGS/Entities/LabNotebookEntryContent/TextMarks.py +71 -0
  87. LOGS/Entities/LabNotebookEntryContent/__init__.py +34 -0
  88. LOGS/Entities/LabNotebookEntryRequestParameter.py +2 -0
  89. LOGS/Entities/LabNotebookExperiment.py +52 -0
  90. LOGS/Entities/LabNotebookExperimentMinimal.py +8 -0
  91. LOGS/Entities/LabNotebookExperimentRequestParameter.py +49 -0
  92. LOGS/Entities/LabNotebookExperiments.py +16 -0
  93. LOGS/Entities/LabNotebookMinimal.py +19 -0
  94. LOGS/Entities/LabNotebookModels.py +14 -0
  95. LOGS/Entities/LabNotebookRequestParameter.py +43 -0
  96. LOGS/Entities/LabNotebooks.py +12 -0
  97. LOGS/Entities/Method.py +3 -3
  98. LOGS/Entities/ParserLog.py +4 -0
  99. LOGS/Entities/Person.py +2 -2
  100. LOGS/Entities/Project.py +7 -7
  101. LOGS/Entities/{ProjectUserPermission.py → ProjectPersonPermission.py} +14 -4
  102. LOGS/Entities/Role.py +3 -3
  103. LOGS/Entities/RunState.py +1 -0
  104. LOGS/Entities/Sample.py +36 -57
  105. LOGS/Entities/SampleRequestParameter.py +30 -15
  106. LOGS/Entities/Track.py +10 -6
  107. LOGS/Entities/TrackData.py +11 -0
  108. LOGS/Entities/TrackImage.py +21 -0
  109. LOGS/Entities/TrackImageData.py +20 -0
  110. LOGS/Entities/TrackMatrix.py +28 -0
  111. LOGS/Entities/TrackMatrixData.py +22 -0
  112. LOGS/Entities/TrackTable.py +21 -0
  113. LOGS/Entities/TrackTableData.py +22 -0
  114. LOGS/Entities/TrackXY.py +5 -1
  115. LOGS/Entities/TrackXYComplex.py +1 -1
  116. LOGS/Entities/__init__.py +26 -7
  117. LOGS/Entity/ConnectedEntity.py +39 -1
  118. LOGS/Entity/Entity.py +9 -14
  119. LOGS/Entity/SerializeableContent.py +127 -45
  120. LOGS/Interfaces/IHierarchyType.py +63 -0
  121. LOGS/Interfaces/IPermissionedEntity.py +29 -5
  122. LOGS/Interfaces/IProjectBased.py +1 -1
  123. LOGS/Interfaces/IRelatedEntity.py +3 -2
  124. LOGS/Interfaces/ITypedEntity.py +69 -12
  125. LOGS/Interfaces/IVersionedEntity.py +39 -0
  126. LOGS/LOGS.py +140 -48
  127. LOGS/LOGSConnection.py +52 -24
  128. LOGS/LOGSOptions.py +8 -0
  129. LOGS/Parameters/Color.py +92 -0
  130. LOGS/Parameters/ParameterBase.py +55 -0
  131. LOGS/Parameters/ParameterConverter.py +24 -0
  132. LOGS/Parameters/ParameterElement.py +99 -0
  133. LOGS/Parameters/ParameterList.py +52 -0
  134. LOGS/Parameters/ParameterTable.py +64 -0
  135. LOGS/Parameters/__init__.py +13 -0
  136. LOGS/__init__.py +1 -0
  137. {logs_py-2.9.5.dist-info → logs_py-3.0.0.dist-info}/METADATA +3 -2
  138. logs_py-3.0.0.dist-info/RECORD +263 -0
  139. {logs_py-2.9.5.dist-info → logs_py-3.0.0.dist-info}/WHEEL +1 -1
  140. LOGS/Entities/CustomFieldEnums.py +0 -25
  141. LOGS/Entities/DatasetType.py +0 -7
  142. LOGS/Entities/DatasetTypeMinimal.py +0 -8
  143. LOGS/Entities/SampleType.py +0 -34
  144. LOGS/Entities/SampleTypeMinimal.py +0 -8
  145. LOGS/Entities/SampleTypeRequestParameter.py +0 -8
  146. LOGS/Entities/SampleTypes.py +0 -12
  147. logs_py-2.9.5.dist-info/RECORD +0 -183
  148. {logs_py-2.9.5.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 IPermissionedEntity
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, INamedEntity, IRelatedEntity[BridgeRelations], IPermissionedEntity
18
+ IEntityWithIntId,
19
+ INamedEntity,
20
+ IRelatedEntity[BridgeRelations],
21
+ GenericPermissionEntity,
19
22
  ):
20
- _relationType = type(BridgeRelations)
23
+ _relationType = BridgeRelations
21
24
 
22
25
  _type: Optional[BridgeType]
23
26
  _hostname: Optional[str]
@@ -1,98 +1,70 @@
1
- from datetime import datetime
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.Entities.CustomFieldEnums import CustomFieldDataTypes, CustomFieldTypes
8
- from LOGS.Entity.EntityWithStrId import EntityWithStrId
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
- EntityWithStrId,
24
+ IEntityWithIntId,
17
25
  IOwnedEntity,
18
26
  INamedEntity,
27
+ IUniqueEntity,
28
+ ICreationRecord,
29
+ IModificationRecord,
30
+ IRelatedEntity[CustomFieldRelations],
31
+ ILiterarTypedEntity,
32
+ GenericPermissionEntity,
19
33
  ):
20
- _createdAt: Optional[datetime]
21
- _widget: Optional[CustomFieldTypes] = CustomFieldTypes.Text
22
- _type: Optional[CustomFieldDataTypes] = CustomFieldDataTypes.String
23
- _description: Optional[str]
24
- _defaultValue: Optional[str]
25
- _isReadOnly: Optional[bool]
26
- _isRequired: Optional[bool]
27
- _isMulti: Optional[bool]
28
- _validationRegexp: Optional[str]
29
- _validationMessage: Optional[str]
30
- _enumOptions: Optional[List[str]]
31
-
32
- _alphanumeric = Regex(r"[^a-zA-Z0-9_]")
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[str] = None,
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
 
59
59
  super().__init__(connection=connection, id=id, ref=ref)
60
60
 
61
- def fromDict(self, ref, formatDict=None) -> None:
61
+ def fromDict(self, ref) -> None:
62
62
  if isinstance(ref, dict) and "type" in ref and isinstance(ref["type"], int):
63
63
  del ref["type"]
64
64
  if isinstance(ref, dict) and "widget" in ref and isinstance(ref["widget"], int):
65
65
  del ref["widget"]
66
66
 
67
- super().fromDict(ref=ref, formatDict=formatDict)
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")
67
+ super().fromDict(ref=ref)
96
68
 
97
69
  @property
98
70
  def description(self) -> Optional[str]:
@@ -111,28 +83,20 @@ class CustomField(
111
83
  self._defaultValue = self.checkAndConvertNullable(value, str, "defaultValue")
112
84
 
113
85
  @property
114
- def isReadOnly(self) -> Optional[bool]:
115
- return self._isReadOnly
86
+ def readOnly(self) -> Optional[bool]:
87
+ return self._readOnly
116
88
 
117
- @isReadOnly.setter
118
- def isReadOnly(self, value):
119
- self._isReadOnly = self.checkAndConvertNullable(value, bool, "isReadOnly")
89
+ @readOnly.setter
90
+ def readOnly(self, value):
91
+ self._readOnly = self.checkAndConvertNullable(value, bool, "readOnly")
120
92
 
121
93
  @property
122
- def isRequired(self) -> Optional[bool]:
123
- return self._isRequired
94
+ def required(self) -> Optional[bool]:
95
+ return self._required
124
96
 
125
- @isRequired.setter
126
- def isRequired(self, value):
127
- self._isRequired = self.checkAndConvertNullable(value, bool, "isRequired")
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 name(self) -> Optional[str]:
167
- return self._name
168
-
169
- @name.setter
170
- def name(self, value):
171
- self._name = self.checkAndConvert(value, str, "name", allowNone=True)
172
- if self.id is None or self.id == "":
173
- self.id = self._idFromName(self._name)
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"
@@ -0,0 +1,10 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ from LOGS.Entity.EntityRelations import EntityRelations
4
+
5
+ if TYPE_CHECKING:
6
+ pass
7
+
8
+
9
+ class CustomFieldRelations(EntityRelations):
10
+ """Relations of a CustomType with other entities"""
@@ -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.CustomFieldEnums import CustomFieldPropertyFilters, CustomFieldTypes
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
- name: Optional[str] = None
36
- ownerIds: Optional[List[int]] = None
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