logs-py 2.7.1__py3-none-any.whl → 2.8__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.

@@ -0,0 +1,173 @@
1
+ from datetime import datetime
2
+ from typing import List, Optional
3
+
4
+ from regex import Regex
5
+
6
+ from LOGS.Auxiliary.Decorators import Endpoint
7
+ from LOGS.Entities.CustomFieldEnums import CustomFieldDataTypes, CustomFieldTypes
8
+ from LOGS.Entity.EntityWithStrId import EntityWithStrId
9
+ from LOGS.Interfaces.INamedEntity import INamedEntity
10
+ from LOGS.Interfaces.IOwnedEntity import IOwnedEntity
11
+ from LOGS.LOGSConnection import LOGSConnection
12
+
13
+
14
+ @Endpoint("custom_fields")
15
+ class CustomField(
16
+ EntityWithStrId,
17
+ IOwnedEntity,
18
+ INamedEntity,
19
+ ):
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_]")
33
+
34
+ def __init__(
35
+ self,
36
+ ref=None,
37
+ id: Optional[str] = None,
38
+ connection: Optional[LOGSConnection] = None,
39
+ name: str = "",
40
+ ):
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
+ if ref != None and isinstance(ref, (str, int, float)):
57
+ ref = {"text": str(ref)}
58
+
59
+ super().__init__(connection=connection, id=id, ref=ref)
60
+
61
+ def fromDict(self, ref, formatDict=None) -> None:
62
+ if isinstance(ref, dict) and "type" in ref and isinstance(ref["type"], int):
63
+ del ref["type"]
64
+ if isinstance(ref, dict) and "widget" in ref and isinstance(ref["widget"], int):
65
+ del ref["widget"]
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")
96
+
97
+ @property
98
+ def description(self) -> Optional[str]:
99
+ return self._description
100
+
101
+ @description.setter
102
+ def description(self, value):
103
+ self._description = self.checkAndConvertNullable(value, str, "description")
104
+
105
+ @property
106
+ def defaultValue(self) -> Optional[str]:
107
+ return self._defaultValue
108
+
109
+ @defaultValue.setter
110
+ def defaultValue(self, value):
111
+ self._defaultValue = self.checkAndConvertNullable(value, str, "defaultValue")
112
+
113
+ @property
114
+ def isReadOnly(self) -> Optional[bool]:
115
+ return self._isReadOnly
116
+
117
+ @isReadOnly.setter
118
+ def isReadOnly(self, value):
119
+ self._isReadOnly = self.checkAndConvertNullable(value, bool, "isReadOnly")
120
+
121
+ @property
122
+ def isRequired(self) -> Optional[bool]:
123
+ return self._isRequired
124
+
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")
136
+
137
+ @property
138
+ def validationRegexp(self) -> Optional[str]:
139
+ return self._validationRegexp
140
+
141
+ @validationRegexp.setter
142
+ def validationRegexp(self, value):
143
+ self._validationRegexp = self.checkAndConvertNullable(
144
+ value, str, "validationRegexp"
145
+ )
146
+
147
+ @property
148
+ def validationMessage(self) -> Optional[str]:
149
+ return self._validationMessage
150
+
151
+ @validationMessage.setter
152
+ def validationMessage(self, value):
153
+ self._validationMessage = self.checkAndConvertNullable(
154
+ value, str, "validationMessage"
155
+ )
156
+
157
+ @property
158
+ def enumOptions(self) -> Optional[List[str]]:
159
+ return self._enumOptions
160
+
161
+ @enumOptions.setter
162
+ def enumOptions(self, value):
163
+ self._enumOptions = self.checkListAndConvertNullable(value, str, "enumOptions")
164
+
165
+ @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)
@@ -0,0 +1,25 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CustomFieldTypes(Enum):
5
+ Text = "Text"
6
+ TextArea = "TextArea"
7
+ Number = "Number"
8
+ EnumDropdown = "EnumDropdown"
9
+ Date = "Date"
10
+ Toggle = "Toggle"
11
+
12
+
13
+ class CustomFieldDataTypes(Enum):
14
+ String = "String"
15
+ Date = "Date"
16
+ Number = "Number"
17
+ Boolean = "Boolean"
18
+ DateTime = "DateTime"
19
+
20
+
21
+ class CustomFieldPropertyFilters(Enum):
22
+ DefaultValue = "DefaultValue"
23
+ IsReadOnly = "IsReadOnly"
24
+ IsRequired = "IsRequired"
25
+ ValidationRegexp = "ValidationRegexp"
@@ -0,0 +1,8 @@
1
+ from LOGS.Auxiliary.Decorators import FullModel
2
+ from LOGS.Entities.CustomField import CustomField
3
+ from LOGS.Entity.EntityMinimalWithIntId import EntityMinimalWithIntId
4
+
5
+
6
+ @FullModel(CustomField)
7
+ class CustomFieldMinimal(EntityMinimalWithIntId[CustomField]):
8
+ pass
@@ -0,0 +1,40 @@
1
+ from dataclasses import dataclass
2
+ from datetime import datetime
3
+ from enum import Enum
4
+ from typing import List, Optional
5
+
6
+ from LOGS.Entities.CustomFieldEnums import CustomFieldPropertyFilters, CustomFieldTypes
7
+ from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
8
+ from LOGS.Interfaces.INamedEntity import INamedEntityRequest
9
+ from LOGS.Interfaces.IOwnedEntity import IOwnedEntityRequest
10
+ from LOGS.Interfaces.IPaginationRequest import IPaginationRequest
11
+
12
+
13
+ class CustomFieldOrder(Enum):
14
+ ID_ASC = "ID_ASC"
15
+ ID_DESC = "ID_DESC"
16
+ NAME_ASC = "NAME_ASC"
17
+ 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
+ CREATED_ON_ASC = "CREATED_ON_ASC"
25
+ CREATED_ON_DESC = "CREATED_ON_DESC"
26
+
27
+
28
+ @dataclass
29
+ class CustomFieldRequestParameter(
30
+ EntityRequestParameter[CustomFieldOrder],
31
+ IPaginationRequest,
32
+ IOwnedEntityRequest,
33
+ INamedEntityRequest,
34
+ ):
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
@@ -0,0 +1,12 @@
1
+ from LOGS.Auxiliary.Decorators import Endpoint
2
+ from LOGS.Entities.CustomField import CustomField
3
+ from LOGS.Entities.CustomFieldRequestParameter import CustomFieldRequestParameter
4
+ from LOGS.Entity.EntityIterator import EntityIterator
5
+
6
+
7
+ @Endpoint("custom_fields")
8
+ class CustomFields(EntityIterator[CustomField, CustomFieldRequestParameter]):
9
+ """LOGS connected CustomFields iterator"""
10
+
11
+ _generatorType = CustomField
12
+ _parameterType = CustomFieldRequestParameter
@@ -1,29 +1,43 @@
1
1
  from datetime import datetime
2
- from typing import TYPE_CHECKING, Optional
2
+ from typing import List, Optional
3
3
 
4
+ from regex import Regex
5
+
6
+ from LOGS.Auxiliary.Decorators import Endpoint
7
+ from LOGS.Entities.CustomSchemaSection import CustomSchemaSection
4
8
  from LOGS.Entity.EntityWithStrId import EntityWithStrId
5
9
  from LOGS.Interfaces.INamedEntity import INamedEntity
6
10
  from LOGS.Interfaces.IOwnedEntity import IOwnedEntity
7
11
  from LOGS.LOGSConnection import LOGSConnection
8
12
 
9
- if TYPE_CHECKING:
10
- pass
11
-
12
13
 
14
+ @Endpoint("custom_fields")
13
15
  class CustomSchema(EntityWithStrId, IOwnedEntity, INamedEntity):
14
16
  _createdAt: Optional[datetime]
15
17
  _enabled: Optional[bool]
18
+ _sections: Optional[List[CustomSchemaSection]]
19
+
20
+ _alphanumeric = Regex(r"[^a-zA-Z0-9_]")
16
21
 
17
22
  def __init__(
18
23
  self,
19
24
  ref=None,
20
25
  id: Optional[str] = None,
21
26
  connection: Optional[LOGSConnection] = None,
27
+ name: str = "",
22
28
  ):
23
- self._name = None
29
+ self._name = name
30
+ if id is None or id == "":
31
+ id = self._idFromName(name)
24
32
  self._createdAt = None
25
33
  self._enabled = None
26
- super().__init__(ref=ref, id=id, connection=connection)
34
+ self._sections = None
35
+
36
+ super().__init__(connection=connection, id=id, ref=ref)
37
+
38
+ @classmethod
39
+ def _idFromName(cls, name):
40
+ return cls._alphanumeric.sub("_", name).lower()
27
41
 
28
42
  @property
29
43
  def createdAt(self) -> Optional[datetime]:
@@ -33,6 +47,16 @@ class CustomSchema(EntityWithStrId, IOwnedEntity, INamedEntity):
33
47
  def createdAt(self, value):
34
48
  self._createdAt = self.checkAndConvertNullable(value, datetime, "createdAt")
35
49
 
50
+ @property
51
+ def name(self) -> Optional[str]:
52
+ return self._name
53
+
54
+ @name.setter
55
+ def name(self, value):
56
+ self._name = self.checkAndConvert(value, str, "name", allowNone=True)
57
+ if self.id is None or self.id == "":
58
+ self.id = self._idFromName(self._name)
59
+
36
60
  @property
37
61
  def enabled(self) -> Optional[bool]:
38
62
  return self._enabled
@@ -40,3 +64,13 @@ class CustomSchema(EntityWithStrId, IOwnedEntity, INamedEntity):
40
64
  @enabled.setter
41
65
  def enabled(self, value):
42
66
  self._enabled = self.checkAndConvertNullable(value, bool, "enabled")
67
+
68
+ @property
69
+ def sections(self) -> Optional[List[CustomSchemaSection]]:
70
+ return self._sections
71
+
72
+ @sections.setter
73
+ def sections(self, value):
74
+ self._sections = self.checkListAndConvertNullable(
75
+ value, CustomSchemaSection, "sections"
76
+ )
@@ -0,0 +1,41 @@
1
+ from dataclasses import dataclass
2
+ from datetime import datetime
3
+ from enum import Enum
4
+ from typing import Generic, List, Optional, TypeVar
5
+
6
+ from LOGS.Entity.EntityRequestParameter import EntityRequestParameter
7
+ from LOGS.Interfaces.INamedEntity import INamedEntityRequest
8
+ from LOGS.Interfaces.IOwnedEntity import IOwnedEntityRequest
9
+ from LOGS.Interfaces.IPaginationRequest import IPaginationRequest
10
+
11
+
12
+ class CustomSchemaOrder(Enum):
13
+ ID_ASC = "ID_ASC"
14
+ ID_DESC = "ID_DESC"
15
+ NAME_ASC = "NAME_ASC"
16
+ NAME_DESC = "NAME_DESC"
17
+ TYPE_ASC = "TYPE_ASC"
18
+ TYPE_DESC = "TYPE_DESC"
19
+ OWNER_ASC = "OWNER_ASC"
20
+ OWNER_DESC = "OWNER_DESC"
21
+ CREATED_ON_ASC = "CREATED_ON_ASC"
22
+ CREATED_ON_DESC = "CREATED_ON_DESC"
23
+
24
+
25
+ _Sorting = TypeVar("_Sorting", bound=Enum)
26
+
27
+
28
+ @dataclass
29
+ class CustomSchemaParameter(
30
+ Generic[_Sorting],
31
+ EntityRequestParameter[_Sorting],
32
+ IPaginationRequest,
33
+ IOwnedEntityRequest,
34
+ INamedEntityRequest,
35
+ ):
36
+ name: Optional[str] = None
37
+ ownerIds: Optional[List[int]] = None
38
+ creationDateFrom: Optional[datetime] = None
39
+ creationDateTo: Optional[datetime] = None
40
+ customFieldIds: Optional[List[str]] = None
41
+ isEnabled: Optional[bool] = None
@@ -0,0 +1,42 @@
1
+ from typing import TYPE_CHECKING, List, Optional
2
+
3
+ from LOGS.Entities.CustomField import CustomField
4
+ from LOGS.Entity.SerializeableContent import SerializeableContent
5
+ from LOGS.Interfaces.INamedEntity import INamedEntity
6
+
7
+ if TYPE_CHECKING:
8
+ pass
9
+
10
+
11
+ class CustomSchemaSection(SerializeableContent, INamedEntity):
12
+ _isFolded: Optional[bool]
13
+ _children: Optional[List[CustomField]]
14
+
15
+ def __init__(
16
+ self,
17
+ ref=None,
18
+ name: str = "",
19
+ ):
20
+ self._name = name
21
+ self._isFolded = None
22
+ self._children = None
23
+
24
+ super().__init__(ref=ref)
25
+
26
+ @property
27
+ def isFolded(self) -> Optional[bool]:
28
+ return self._isFolded
29
+
30
+ @isFolded.setter
31
+ def isFolded(self, value):
32
+ self._isFolded = self.checkAndConvertNullable(value, bool, "isRequired")
33
+
34
+ @property
35
+ def children(self) -> Optional[List[CustomField]]:
36
+ return self._children
37
+
38
+ @children.setter
39
+ def children(self, value):
40
+ self._children = self.checkListAndConvertNullable(
41
+ value, CustomField, "children"
42
+ )
LOGS/Entities/Project.py CHANGED
@@ -4,6 +4,7 @@ from LOGS.Auxiliary.Decorators import Endpoint
4
4
  from LOGS.Entities.ProjectRelations import ProjectRelations
5
5
  from LOGS.Entities.ProjectUserPermission import ProjectUserPermission
6
6
  from LOGS.Entity.EntityWithIntId import IEntityWithIntId
7
+ from LOGS.Entity.SerializeableContent import SerializeableClass
7
8
  from LOGS.Interfaces.ICreationRecord import ICreationRecord
8
9
  from LOGS.Interfaces.IModificationRecord import IModificationRecord
9
10
  from LOGS.Interfaces.INamedEntity import INamedEntity
@@ -13,6 +14,15 @@ from LOGS.Interfaces.IUniqueEntity import IUniqueEntity
13
14
  from LOGS.LOGSConnection import LOGSConnection
14
15
 
15
16
 
17
+ class ProjectTag(SerializeableClass):
18
+ id: Optional[int] = None
19
+ name: Optional[str] = None
20
+
21
+ def __str__(self):
22
+ s = (" name:'%s'" % getattr(self, "name")) if hasattr(self, "name") else ""
23
+ return "<%s id:%s%s>" % (type(self).__name__, str(self.id), s)
24
+
25
+
16
26
  @Endpoint("projects")
17
27
  class Project(
18
28
  IEntityWithIntId,
@@ -26,7 +36,7 @@ class Project(
26
36
  _relationType = type(ProjectRelations)
27
37
 
28
38
  _notes: Optional[str]
29
- _tags: Optional[List[str]]
39
+ _projectTags: Optional[List[ProjectTag]]
30
40
  _relations: Optional[ProjectRelations]
31
41
  _userPermissions: Optional[List[ProjectUserPermission]]
32
42
 
@@ -41,7 +51,7 @@ class Project(
41
51
 
42
52
  self._name = name
43
53
  self._notes = None
44
- self._tags = None
54
+ self._projectTags = None
45
55
  self._relations = None
46
56
  self._userPermissions = None
47
57
  super().__init__(ref=ref, id=id, connection=connection)
@@ -55,12 +65,14 @@ class Project(
55
65
  self._notes = self.checkAndConvertNullable(value, str, "notes")
56
66
 
57
67
  @property
58
- def tags(self) -> Optional[List[str]]:
59
- return self._tags
68
+ def projectTags(self) -> Optional[List[ProjectTag]]:
69
+ return self._projectTags
60
70
 
61
- @tags.setter
62
- def tags(self, value):
63
- self._tags = self.checkListAndConvertNullable(value, str, "tags")
71
+ @projectTags.setter
72
+ def projectTags(self, value):
73
+ self._projectTags = self.checkListAndConvertNullable(
74
+ value, ProjectTag, "projectTags"
75
+ )
64
76
 
65
77
  @property
66
78
  def relations(self) -> Optional[ProjectRelations]:
@@ -1,7 +1,34 @@
1
+ from typing import Optional
2
+
1
3
  from LOGS.Auxiliary.Decorators import Endpoint
2
4
  from LOGS.Entities.CustomSchema import CustomSchema
5
+ from LOGS.Entity.SerializeableContent import SerializeableClass
6
+ from LOGS.LOGSConnection import LOGSConnection
7
+
8
+
9
+ class SampleTypeStats(SerializeableClass):
10
+ samples: Optional[int] = None
3
11
 
4
12
 
5
13
  @Endpoint("sample_types")
6
14
  class SampleType(CustomSchema):
7
- pass
15
+ _stats: Optional[SampleTypeStats]
16
+
17
+ def __init__(
18
+ self,
19
+ ref=None,
20
+ id: Optional[str] = None,
21
+ connection: Optional[LOGSConnection] = None,
22
+ name: str = "",
23
+ ):
24
+ self._stats = None
25
+
26
+ super().__init__(ref, id, connection, name)
27
+
28
+ @property
29
+ def stats(self) -> Optional[SampleTypeStats]:
30
+ return self._stats
31
+
32
+ @stats.setter
33
+ def stats(self, value):
34
+ self._stats = self.checkAndConvertNullable(value, SampleTypeStats, "stats")
@@ -0,0 +1,8 @@
1
+ from dataclasses import dataclass
2
+
3
+ from LOGS.Entities.CustomSchemaParameter import CustomSchemaOrder, CustomSchemaParameter
4
+
5
+
6
+ @dataclass
7
+ class SampleTypeRequestParameter(CustomSchemaParameter[CustomSchemaOrder]):
8
+ pass
@@ -0,0 +1,12 @@
1
+ from LOGS.Auxiliary.Decorators import Endpoint
2
+ from LOGS.Entities.SampleType import SampleType
3
+ from LOGS.Entities.SampleTypeRequestParameter import SampleTypeRequestParameter
4
+ from LOGS.Entity.EntityIterator import EntityIterator
5
+
6
+
7
+ @Endpoint("sample_types")
8
+ class SampleTypes(EntityIterator[SampleType, SampleTypeRequestParameter]):
9
+ """LOGS connected SampleTypes iterator"""
10
+
11
+ _generatorType = SampleType
12
+ _parameterType = SampleTypeRequestParameter
LOGS/Entities/__init__.py CHANGED
@@ -14,6 +14,9 @@ from .Bridge import *
14
14
  from .BridgeMinimal import *
15
15
  from .BridgeRequestParameter import *
16
16
  from .BridgeType import *
17
+ from .CustomField import *
18
+ from .CustomFieldEnums import *
19
+ from .CustomFieldRequestParameter import *
17
20
  from .CustomSchema import *
18
21
  from .Dataset import *
19
22
  from .DatasetCreator import *
@@ -92,6 +95,7 @@ from .SampleRequestParameter import *
92
95
  from .Samples import *
93
96
  from .SampleType import *
94
97
  from .SampleTypeMinimal import *
98
+ from .SampleTypeRequestParameter import *
95
99
  from .Track import *
96
100
  from .TrackData import *
97
101
  from .TrackSettings import *
LOGS/LOGS.py CHANGED
@@ -36,51 +36,33 @@ from LOGS.Auxiliary import (
36
36
  Tools,
37
37
  formatErrorMessage,
38
38
  )
39
- from LOGS.Entities import (
40
- Bridge,
41
- Dataset,
42
- DatasetCreator,
43
- DatasetMatching,
44
- DatasetRequestParameter,
45
- Datasets,
46
- DatasetsUpdatableFiles,
47
- Document,
48
- DocumentRequestParameter,
49
- Documents,
50
- Entities,
51
- EntitiesRequestParameter,
52
- EntityOriginWriteModelWithId,
53
- Equipment,
54
- Experiment,
55
- ExperimentRequestParameter,
56
- Experiments,
57
- FileEntry,
58
- Instrument,
59
- InstrumentRequestParameter,
60
- Instruments,
61
- IUniqueEntity,
62
- LabNotebookEntry,
63
- Method,
64
- MethodRequestParameter,
65
- Methods,
66
- Origin,
67
- OriginRequestParameter,
68
- Origins,
69
- Person,
70
- PersonRequestParameter,
71
- Persons,
72
- Project,
73
- ProjectRequestParameter,
74
- Projects,
75
- Sample,
76
- SampleRequestParameter,
77
- Samples,
78
- )
39
+ from LOGS.Entities import SampleType
40
+ from LOGS.Entities.Bridge import Bridge
79
41
  from LOGS.Entities.BridgeRequestParameter import BridgeRequestParameter
80
42
  from LOGS.Entities.Bridges import Bridges
43
+ from LOGS.Entities.CustomField import CustomField
44
+ from LOGS.Entities.CustomFieldRequestParameter import CustomFieldRequestParameter
45
+ from LOGS.Entities.CustomFields import CustomFields
46
+ from LOGS.Entities.Dataset import Dataset
47
+ from LOGS.Entities.DatasetCreator import DatasetCreator
48
+ from LOGS.Entities.DatasetMatching import DatasetMatching
49
+ from LOGS.Entities.DatasetMatchTypes import DatasetsUpdatableFiles
50
+ from LOGS.Entities.DatasetRequestParameter import DatasetRequestParameter
51
+ from LOGS.Entities.Datasets import Datasets
81
52
  from LOGS.Entities.DataSource import DataSource
82
53
  from LOGS.Entities.DataSourceRequestParameter import DataSourceRequestParameter
83
54
  from LOGS.Entities.DataSources import DataSources
55
+ from LOGS.Entities.Document import Document
56
+ from LOGS.Entities.DocumentRequestParameter import DocumentRequestParameter
57
+ from LOGS.Entities.Documents import Documents
58
+ from LOGS.Entities.Entities import Entities
59
+ from LOGS.Entities.EntitiesRequestParameter import EntitiesRequestParameter
60
+ from LOGS.Entities.EntityOriginWriteModelWithId import EntityOriginWriteModelWithId
61
+ from LOGS.Entities.Equipment import Equipment
62
+ from LOGS.Entities.Experiment import Experiment
63
+ from LOGS.Entities.ExperimentRequestParameter import ExperimentRequestParameter
64
+ from LOGS.Entities.Experiments import Experiments
65
+ from LOGS.Entities.FileEntry import FileEntry
84
66
  from LOGS.Entities.Format import Format
85
67
  from LOGS.Entities.FormatFormat import FormatFormat
86
68
  from LOGS.Entities.FormatFormatRequestParameter import FormatFormatRequestParameter
@@ -98,16 +80,38 @@ from LOGS.Entities.Formats import Formats
98
80
  from LOGS.Entities.FormatVendor import FormatVendor
99
81
  from LOGS.Entities.FormatVendorRequestParameter import FormatVendorRequestParameter
100
82
  from LOGS.Entities.FormatVendors import FormatVendors
83
+ from LOGS.Entities.Instrument import Instrument
84
+ from LOGS.Entities.InstrumentRequestParameter import InstrumentRequestParameter
85
+ from LOGS.Entities.Instruments import Instruments
101
86
  from LOGS.Entities.LabNotebookEntries import LabNotebookEntries
87
+ from LOGS.Entities.LabNotebookEntry import LabNotebookEntry
102
88
  from LOGS.Entities.LabNotebookEntryRequestParameter import (
103
89
  LabNotebookEntryRequestParameter,
104
90
  )
91
+ from LOGS.Entities.Method import Method
92
+ from LOGS.Entities.MethodRequestParameter import MethodRequestParameter
93
+ from LOGS.Entities.Methods import Methods
94
+ from LOGS.Entities.Origin import Origin
95
+ from LOGS.Entities.OriginRequestParameter import OriginRequestParameter
96
+ from LOGS.Entities.Origins import Origins
97
+ from LOGS.Entities.Person import Person
98
+ from LOGS.Entities.PersonRequestParameter import PersonRequestParameter
99
+ from LOGS.Entities.Persons import Persons
100
+ from LOGS.Entities.Project import Project
101
+ from LOGS.Entities.ProjectRequestParameter import ProjectRequestParameter
102
+ from LOGS.Entities.Projects import Projects
105
103
  from LOGS.Entities.Role import Role
106
104
  from LOGS.Entities.RoleRequestParameter import RoleRequestParameter
107
105
  from LOGS.Entities.Roles import Roles
106
+ from LOGS.Entities.Sample import Sample
107
+ from LOGS.Entities.SampleRequestParameter import SampleRequestParameter
108
+ from LOGS.Entities.Samples import Samples
109
+ from LOGS.Entities.SampleTypeRequestParameter import SampleTypeRequestParameter
110
+ from LOGS.Entities.SampleTypes import SampleTypes
108
111
  from LOGS.Entity import Entity, EntityIterator, IEntityWithIntId
109
112
  from LOGS.Entity.ConnectedEntity import ConnectedEntity
110
113
  from LOGS.Interfaces.ISoftDeletable import ISoftDeletable
114
+ from LOGS.Interfaces.IUniqueEntity import IUniqueEntity
111
115
  from LOGS.LOGSConnection import LOGSConnection
112
116
 
113
117
  _T = TypeVar(
@@ -132,6 +136,8 @@ _T = TypeVar(
132
136
  FormatMethod,
133
137
  FormatInstrument,
134
138
  FormatFormat,
139
+ CustomField,
140
+ SampleType,
135
141
  )
136
142
 
137
143
 
@@ -153,6 +159,8 @@ class LOGS:
153
159
  Method,
154
160
  LabNotebookEntry,
155
161
  Origin,
162
+ CustomField,
163
+ SampleType,
156
164
  ]
157
165
  _entityByName = {t.__name__: t for t in _entities}
158
166
  _defaultConfigFile: str = "logs.json"
@@ -1034,6 +1042,40 @@ class LOGS:
1034
1042
  )
1035
1043
  return FormatFormats(connection=self._connection, parameters=parameter)
1036
1044
 
1045
+ def customField(self, id: int) -> CustomField:
1046
+ return self._fetchEntity(CustomField, id)
1047
+
1048
+ def customFields(
1049
+ self, parameter: Optional[CustomFieldRequestParameter] = None
1050
+ ) -> CustomFields:
1051
+ if parameter and not isinstance(parameter, CustomFieldRequestParameter):
1052
+ raise LOGSException(
1053
+ "Parameter for %s.CustomFields must be of type %a. (Got %a)"
1054
+ % (
1055
+ type(self).__name__,
1056
+ CustomFieldRequestParameter.__name__,
1057
+ type(parameter).__name__,
1058
+ )
1059
+ )
1060
+ return CustomFields(connection=self._connection, parameters=parameter)
1061
+
1062
+ def sampleType(self, id: str) -> SampleType:
1063
+ return self._fetchEntity(SampleType, id)
1064
+
1065
+ def sampleTypes(
1066
+ self, parameter: Optional[SampleTypeRequestParameter] = None
1067
+ ) -> SampleTypes:
1068
+ if parameter and not isinstance(parameter, SampleTypeRequestParameter):
1069
+ raise LOGSException(
1070
+ "Parameter for %s.SampleTypes must be of type %a. (Got %a)"
1071
+ % (
1072
+ type(self).__name__,
1073
+ SampleTypeRequestParameter.__name__,
1074
+ type(parameter).__name__,
1075
+ )
1076
+ )
1077
+ return SampleTypes(connection=self._connection, parameters=parameter)
1078
+
1037
1079
  def entity(self, uid: str):
1038
1080
  return Entities(connection=self._connection).fetch(uid=uid)
1039
1081
 
LOGS/LOGSConnection.py CHANGED
@@ -147,7 +147,7 @@ class LOGSConnection:
147
147
  or self._metadata.apiVersion not in self._compatibleAPIVersions
148
148
  ):
149
149
  raise LOGSException(
150
- "This libraray is not compatible with the LOGS API version '%s'. (Expected %s %s)"
150
+ "This library is not compatible with the LOGS API version '%s'. (Expected %s %s)"
151
151
  % (
152
152
  (
153
153
  self._metadata.apiVersion
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logs-py
3
- Version: 2.7.1
3
+ Version: 2.8
4
4
  Summary: A python interface for the LOGS public API
5
5
  Home-page: https://docs.logs-python.com
6
6
  Author: Sina Kazemi
@@ -1,5 +1,5 @@
1
- LOGS/LOGS.py,sha256=weR3ZmO7cximZi12_o6MooGUI_71ssSlVRcFA6B8lLc,38570
2
- LOGS/LOGSConnection.py,sha256=3cPSxEWS_Y3w6oYAmOfAEI0wPYf16nWyJ63uCtwHTwE,19846
1
+ LOGS/LOGS.py,sha256=DooJ7JjAsLAEth1YJmdVvFuirguv74oQexkIE_oJGTM,41673
2
+ LOGS/LOGSConnection.py,sha256=GOkmFj7CtCinn9SmRkzzdToaZqnmUaiqwuMI0mQGvCo,19845
3
3
  LOGS/ServerMetaData.py,sha256=WdXCCiCSFqER6s9c3N3v0O273OvxygxBzmE6_C8FmXs,3361
4
4
  LOGS/__init__.py,sha256=faGD87i0eeKbqEq6DTcteF6KoNa2O0BH1RnjxEvuGbQ,253
5
5
  LOGS/Auxiliary/Constants.py,sha256=jKsThb6TS6b1adgnv1uAoqohBJi8ySGo7fULHlE2Es0,2504
@@ -23,7 +23,14 @@ LOGS/Entities/BridgeRelations.py,sha256=nI6mqu_BIDt01tKHKyK38COHhpqrRHCi8wyy9Iyw
23
23
  LOGS/Entities/BridgeRequestParameter.py,sha256=OwBb72M2Jmft6D_04mmSbYzOMaK7GsfffB_s3tVwjJs,722
24
24
  LOGS/Entities/BridgeType.py,sha256=YB55JKJtS38fAlRb5T_OIPvT2qTJIzUC6uoC24eq3sE,88
25
25
  LOGS/Entities/Bridges.py,sha256=WgspgZ9zXxi9tDPg4JPsDLq-fvNQkiaUbKEfbz1iG7E,420
26
- LOGS/Entities/CustomSchema.py,sha256=8ACKbuC_nEZWstFBQvsChqEQmyGvrRxy9_tnFdU2A5Q,1185
26
+ LOGS/Entities/CustomField.py,sha256=jUvaEHdWiVnimao8sD1sgKvYDMqP5GOSO42aag7oiaY,5219
27
+ LOGS/Entities/CustomFieldEnums.py,sha256=JNvaMmvzDKaoI504XgE8pjKrpzE0sZ6j9jA6fi-tZzM,520
28
+ LOGS/Entities/CustomFieldMinimal.py,sha256=GrfKIeyE1Bp4vvCA1zVoN9Hp73Vlt0Vw7z5wUKBhpvQ,266
29
+ LOGS/Entities/CustomFieldRequestParameter.py,sha256=lIkSRNteqOMFtkfv5c-6MT6FhHDlXlqAQG6NUf5Gb0U,1307
30
+ LOGS/Entities/CustomFields.py,sha256=-LVjEtaKvyzVFcT7JkhPUnaoKu6-7TvZEB6kl2ZLnM0,470
31
+ LOGS/Entities/CustomSchema.py,sha256=LD2PIpWKSBd8b9bMBZXdNqIMBGtMgcMVVOwMfE5I0R4,2223
32
+ LOGS/Entities/CustomSchemaParameter.py,sha256=hU7bB0QiKHM9bSjunZePqB5Xvmm01g1cGP3H-6QHxi8,1195
33
+ LOGS/Entities/CustomSchemaSection.py,sha256=j_dpOJvDjXKk5zkwrsxhNu0k2Yi97mO5YX45JZSAw3g,1075
27
34
  LOGS/Entities/DataSource.py,sha256=puyFmrW3ciJ4JZPfIPkM9B4_VFy-WPgmCgUPo4pqWIM,6307
28
35
  LOGS/Entities/DataSourceMinimal.py,sha256=KlejLccyZR_AP2LvFQgCJXpcmWwtaOg6rRTVsXXlODI,261
29
36
  LOGS/Entities/DataSourceRelations.py,sha256=eIszpHjZqz6v4WyhaPNu8efSzedsJLNrYR9b3hCa3HY,658
@@ -110,7 +117,7 @@ LOGS/Entities/PersonMinimal.py,sha256=W5lhHvFtYi_Ln4B9g91pnZddrhyJGoOwiX81hszmKN
110
117
  LOGS/Entities/PersonRelations.py,sha256=kN8Rfkg5qP0QSLbmCcqonZjKW5VtDSDyCMJ5WoUDvHk,2701
111
118
  LOGS/Entities/PersonRequestParameter.py,sha256=PsWJJeawEvhL_HcjD5NwvoSXrfXMIn3oN_BCvAfVCfE,2113
112
119
  LOGS/Entities/Persons.py,sha256=cj4SKaJZvitaIe7Fd1M9_qqNdAEEG38iuMPNiKPDPUA,413
113
- LOGS/Entities/Project.py,sha256=rtmWRJTOK5Gafq38CO3mX_udgbNXashHK0TdKXCd0oE,2520
120
+ LOGS/Entities/Project.py,sha256=uuW66BScwuf1mjpoTHBLp8skXRV_yZCuteIzYtB3rdk,2962
114
121
  LOGS/Entities/ProjectMinimal.py,sha256=Xw8wnA2iSixEkVaisY_b4Z3Ujudum3MG6tBUfbiAk0s,246
115
122
  LOGS/Entities/ProjectRelations.py,sha256=Hf3F42iYanTqrLgG6GjY4HXBCFWCcVNjXzwrnEJc9GU,2136
116
123
  LOGS/Entities/ProjectRequestParameter.py,sha256=KRq5HlTySlROsS-hrbDEGDy22_chz_NA_KXXSMUH7NY,1923
@@ -126,8 +133,10 @@ LOGS/Entities/Sample.py,sha256=RWfGDpj8terRfdt8cajHalK-P5rdqWYu92PtiL-2A90,6610
126
133
  LOGS/Entities/SampleMinimal.py,sha256=rlLN_MVB2KNxY9wTbArnDGtyGrQ0_NGllGzocNxeZSY,241
127
134
  LOGS/Entities/SampleRelations.py,sha256=dVCJGrM90sbme63PzWrFhbrzaEdWm_-OtaUfMfihQcs,1423
128
135
  LOGS/Entities/SampleRequestParameter.py,sha256=3irGUXGit2dKaiW5EizH2VeDp-4Hosrom4fuTCDzoZQ,1586
129
- LOGS/Entities/SampleType.py,sha256=8DlY-rebHQyv-kq6uVmgBGRov5347HAPi_VOBkBtky4,168
136
+ LOGS/Entities/SampleType.py,sha256=OuYa6CD5c_aZ7rw9ij5ozSj757jSUzq2K0Ryke46vjY,888
130
137
  LOGS/Entities/SampleTypeMinimal.py,sha256=e5bJ2ZJwJu9fMugaXrp9MxBsPkpNEihhx0fWncX5V5A,261
138
+ LOGS/Entities/SampleTypeRequestParameter.py,sha256=uWkYftn9c0iin0i2JobawECEUmCjsX8dSh0jXswDo58,222
139
+ LOGS/Entities/SampleTypes.py,sha256=cdkSBl5eZMTf431TZBCsfnKQ45QZGVys9CcXKkPTXL4,459
131
140
  LOGS/Entities/Samples.py,sha256=fAOp5MvHnACilEF0gehmdmLD3-gdvDEZAFAHitm3ib0,414
132
141
  LOGS/Entities/Track.py,sha256=a72Qiq5ZjvifqbBc2y7IfKhJspRWltBXxKR9_HEC_LQ,2782
133
142
  LOGS/Entities/TrackData.py,sha256=0qNQIVQPeNWex8L8d12lXlbGvihezJRfAZY0ghdd-yc,287
@@ -136,7 +145,7 @@ LOGS/Entities/TrackXY.py,sha256=rffrNVR8DbQpWcjQpFMM1_7OnefKEE7UzVWBPfYaRp0,1186
136
145
  LOGS/Entities/TrackXYComplex.py,sha256=dqByLLSTW3WerDrXkfOVgX6Nc2zuXHa6Pf3gulUlb6k,1692
137
146
  LOGS/Entities/TrackXYComplexData.py,sha256=xWd3_jdXa347Gh53NYIMo66nFirA60Zd2KxaPs4KHaY,1368
138
147
  LOGS/Entities/TrackXYData.py,sha256=6AbwG2qa2HN858ROLaLpzkuIlwsb8tN8wznaiKplRdo,819
139
- LOGS/Entities/__init__.py,sha256=S-M2_NYcugZT-kAbksGQ8VknnjBT_wwdiFIXhvhaqrc,3058
148
+ LOGS/Entities/__init__.py,sha256=Os_fyLxwi2bju8GIBy5LpFtlcW7eCGc2NP31g1EEhoQ,3202
140
149
  LOGS/Entity/ConnectedEntity.py,sha256=RIaOcOJWCrWooc9H8CkN4tbrLD0q4pM4CAeBX3ZRIVg,1617
141
150
  LOGS/Entity/Entity.py,sha256=uF7lCp-4HwUJ90ocRX_GCPu9KAZg2VAF5bCMlVfDtDs,6605
142
151
  LOGS/Entity/EntityConnector.py,sha256=Lp5rGDyTEoayPslieh_3QSzezwLiaj0lehejhu1LdKg,2061
@@ -167,7 +176,7 @@ LOGS/Interfaces/ISoftDeletable.py,sha256=urnmSfcYJrEm1iIo0k3nyBvMMnpomJWAYAON_uv
167
176
  LOGS/Interfaces/ITypedEntity.py,sha256=hMlzGuca8vW1qT5Dop-b-6_gteAeXjK0sz85eRjOZrY,724
168
177
  LOGS/Interfaces/IUniqueEntity.py,sha256=K-Q80qZX1wTjPnjbs-1PF85BbzYre2su_2xMnescYi4,1894
169
178
  LOGS/Interfaces/__init__.py,sha256=tGykqoQeT2_HV-oLYVKJJ9Z0a_Li8_y3AOJjG1btKYw,172
170
- logs_py-2.7.1.dist-info/METADATA,sha256=nwmcxFn89NXtYW3EVIY1FvCV3v3MADBQKfER5a2O8Ws,2004
171
- logs_py-2.7.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
172
- logs_py-2.7.1.dist-info/top_level.txt,sha256=Ckn2LiAmGaR7k3tdEnKAc04z_uboMD4gLreYghRNdCs,5
173
- logs_py-2.7.1.dist-info/RECORD,,
179
+ logs_py-2.8.dist-info/METADATA,sha256=Cs1bFPykFYr4q4gLRtqp_tMVh4evCdS5BHhVUddiG08,2002
180
+ logs_py-2.8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
181
+ logs_py-2.8.dist-info/top_level.txt,sha256=Ckn2LiAmGaR7k3tdEnKAc04z_uboMD4gLreYghRNdCs,5
182
+ logs_py-2.8.dist-info/RECORD,,
File without changes