frost-sta-client 1.1.50__py2.py3-none-any.whl → 1.1.51__py2.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.
@@ -1,210 +1,210 @@
1
- # Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131
2
- # Karlsruhe, Germany.
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU Lesser General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU Lesser General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU Lesser General Public License
15
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- from frost_sta_client.dao.observedproperty import ObservedPropertyDao
18
-
19
- from . import entity
20
- from . import datastream
21
- from . import multi_datastream
22
-
23
- from frost_sta_client import utils
24
- from .ext import entity_type
25
- from .ext import entity_list
26
-
27
-
28
- class ObservedProperty(entity.Entity):
29
-
30
- def __init__(self,
31
- name='',
32
- definition='',
33
- description='',
34
- datastreams=None,
35
- properties=None,
36
- multi_datastreams=None,
37
- **kwargs):
38
- super().__init__(**kwargs)
39
- if properties is None:
40
- properties = {}
41
- self.properties = properties
42
- self.name = name
43
- self.definition = definition
44
- self.description = description
45
- self.datastreams = datastreams
46
- self.multi_datastreams = multi_datastreams
47
-
48
- def __new__(cls, *args, **kwargs):
49
- new_observed_property = super().__new__(cls)
50
- attributes = {'_id': None, '_name': '', '_definition': '', '_description': '',
51
- '_datastreams': None, '_multi_datastreams': None, '_self_link': None, '_service': None}
52
- for key, value in attributes.items():
53
- new_observed_property.__dict__[key] = value
54
- return new_observed_property
55
-
56
- @property
57
- def name(self):
58
- return self._name
59
-
60
- @name.setter
61
- def name(self, value):
62
- if value is None:
63
- self._name = None
64
- return
65
- if not isinstance(value, str):
66
- raise ValueError('name should be of type str!')
67
- self._name = value
68
-
69
- @property
70
- def description(self):
71
- return self._description
72
-
73
- @description.setter
74
- def description(self, value):
75
- if value is None:
76
- self._description = None
77
- return
78
- if not isinstance(value, str):
79
- raise ValueError('description should be of type str!')
80
- self._description = value
81
-
82
- @property
83
- def definition(self):
84
- return self._definition
85
-
86
- @definition.setter
87
- def definition(self, value):
88
- if value is None:
89
- self._definition = None
90
- return
91
- if not isinstance(value, str):
92
- raise ValueError('description should be of type str!')
93
- self._definition = value
94
-
95
- @property
96
- def properties(self):
97
- return self._properties
98
-
99
- @properties.setter
100
- def properties(self, value):
101
- if value is None:
102
- self._properties = {}
103
- return
104
- if not isinstance(value, dict):
105
- raise ValueError('properties should be of type dict!')
106
- self._properties = value
107
-
108
- @property
109
- def datastreams(self):
110
- return self._datastreams
111
-
112
- @datastreams.setter
113
- def datastreams(self, value):
114
- if value is None:
115
- self._datastreams = None
116
- return
117
- if isinstance(value, list) and all(isinstance(ds, datastream.Datastream) for ds in value):
118
- entity_class = entity_type.EntityTypes['Datastream']['class']
119
- self._datastreams = entity_list.EntityList(entity_class=entity_class, entities=value)
120
- return
121
- if not isinstance(value, entity_list.EntityList) \
122
- or any((not isinstance(ds, datastream.Datastream)) for ds in value.entities):
123
- raise ValueError('datastreams should be of list of type Datastream!')
124
- self._datastreams = value
125
-
126
- @property
127
- def multi_datastreams(self):
128
- return self._multi_datastreams
129
-
130
- @multi_datastreams.setter
131
- def multi_datastreams(self, values):
132
- if values is None:
133
- self._multi_datastreams = None
134
- return
135
- if isinstance(values, list) and all(isinstance(mds, multi_datastream.MultiDatastream) for mds in values):
136
- entity_class = entity_type.EntityTypes['MultiDatastream']['class']
137
- self._multi_datastreams = entity_list.EntityList(entity_class=entity_class, entities=values)
138
- return
139
- if not isinstance(values, entity_list.EntityList) or\
140
- any((not isinstance(mds, multi_datastream.MultiDatastream)) for mds in values.entities):
141
- raise ValueError('multi_datastreams should be a list of multi_datastreams!')
142
- self._multi_datastreams = values
143
-
144
- def get_datastreams(self):
145
- result = self.service.datastreams()
146
- result.parent = self
147
- return result
148
-
149
- def get_multi_datastreams(self):
150
- result = self.service.multi_datastreams()
151
- result.parent = self
152
- return result
153
-
154
- def ensure_service_on_children(self, service):
155
- if self.datastreams is not None:
156
- self.datastreams.set_service(service)
157
- if self.multi_datastreams is not None:
158
- self.multi_datastreams.set_service(service)
159
-
160
- def __eq__(self, other):
161
- if not super().__eq__(other):
162
- return False
163
- if self.name != other.name:
164
- return False
165
- if self.description != other.description:
166
- return False
167
- if self.definition != other.definition:
168
- return False
169
- if self.properties != other.properties:
170
- return False
171
- return True
172
-
173
- def __ne__(self, other):
174
- return not self == other
175
-
176
- def __getstate__(self):
177
- data = super().__getstate__()
178
- if self.name is not None and self.name != '':
179
- data['name'] = self.name
180
- if self.description is not None and self.description != '':
181
- data['description'] = self.description
182
- if self.definition is not None and self.definition != '':
183
- data['definition'] = self.definition
184
- if self.properties is not None and self.properties != {}:
185
- data['properties'] = self.properties
186
- if self.datastreams is not None and len(self.datastreams.entities) > 0:
187
- data['Datastreams'] = self.datastreams.__getstate__()
188
- if self.multi_datastreams is not None and len(self.multi_datastreams.entities) > 0:
189
- data['MultiDatastreams'] = self.multi_datastreams.__getstate__()
190
- return data
191
-
192
- def __setstate__(self, state):
193
- super().__setstate__(state)
194
- self.name = state.get("name", None)
195
- self.description = state.get("description", None)
196
- self.definition = state.get("definition", None)
197
- self.properties = state.get("properties", {})
198
- if state.get("Datastreams", None) is not None and isinstance(state["Datastreams"], list):
199
- entity_class = entity_type.EntityTypes['Datastream']['class']
200
- self.datastreams = utils.transform_json_to_entity_list(state['Datastreams'], entity_class)
201
- self.datastreams.next_link = state.get('Datastreams@iot.nextLink', None)
202
- self.datastreams.count = state.get('Datastreams@iot.count', None)
203
- if state.get("MultiDatastreams", None) is not None and isinstance(state["MultiDatastreams"], list):
204
- entity_class = entity_type.EntityTypes['MultiDatastream']['class']
205
- self.multi_datastreams = utils.transform_json_to_entity_list(state['MultiDatatstreams'], entity_class)
206
- self.multi_datastreams.next_link = state.get('MultiDatastreams@iot.nextLink', None)
207
- self.multi_datastreams.count = state.get('MultiDatastreams@iot.count', None)
208
-
209
- def get_dao(self, service):
210
- return ObservedPropertyDao(service)
1
+ # Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131
2
+ # Karlsruhe, Germany.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Lesser General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ from frost_sta_client.dao.observedproperty import ObservedPropertyDao
18
+
19
+ from . import entity
20
+ from . import datastream
21
+ from . import multi_datastream
22
+
23
+ from frost_sta_client import utils
24
+ from .ext import entity_type
25
+ from .ext import entity_list
26
+
27
+
28
+ class ObservedProperty(entity.Entity):
29
+
30
+ def __init__(self,
31
+ name='',
32
+ definition='',
33
+ description='',
34
+ datastreams=None,
35
+ properties=None,
36
+ multi_datastreams=None,
37
+ **kwargs):
38
+ super().__init__(**kwargs)
39
+ if properties is None:
40
+ properties = {}
41
+ self.properties = properties
42
+ self.name = name
43
+ self.definition = definition
44
+ self.description = description
45
+ self.datastreams = datastreams
46
+ self.multi_datastreams = multi_datastreams
47
+
48
+ def __new__(cls, *args, **kwargs):
49
+ new_observed_property = super().__new__(cls)
50
+ attributes = {'_id': None, '_name': '', '_definition': '', '_description': '',
51
+ '_datastreams': None, '_multi_datastreams': None, '_self_link': None, '_service': None}
52
+ for key, value in attributes.items():
53
+ new_observed_property.__dict__[key] = value
54
+ return new_observed_property
55
+
56
+ @property
57
+ def name(self):
58
+ return self._name
59
+
60
+ @name.setter
61
+ def name(self, value):
62
+ if value is None:
63
+ self._name = None
64
+ return
65
+ if not isinstance(value, str):
66
+ raise ValueError('name should be of type str!')
67
+ self._name = value
68
+
69
+ @property
70
+ def description(self):
71
+ return self._description
72
+
73
+ @description.setter
74
+ def description(self, value):
75
+ if value is None:
76
+ self._description = None
77
+ return
78
+ if not isinstance(value, str):
79
+ raise ValueError('description should be of type str!')
80
+ self._description = value
81
+
82
+ @property
83
+ def definition(self):
84
+ return self._definition
85
+
86
+ @definition.setter
87
+ def definition(self, value):
88
+ if value is None:
89
+ self._definition = None
90
+ return
91
+ if not isinstance(value, str):
92
+ raise ValueError('description should be of type str!')
93
+ self._definition = value
94
+
95
+ @property
96
+ def properties(self):
97
+ return self._properties
98
+
99
+ @properties.setter
100
+ def properties(self, value):
101
+ if value is None:
102
+ self._properties = {}
103
+ return
104
+ if not isinstance(value, dict):
105
+ raise ValueError('properties should be of type dict!')
106
+ self._properties = value
107
+
108
+ @property
109
+ def datastreams(self):
110
+ return self._datastreams
111
+
112
+ @datastreams.setter
113
+ def datastreams(self, value):
114
+ if value is None:
115
+ self._datastreams = None
116
+ return
117
+ if isinstance(value, list) and all(isinstance(ds, datastream.Datastream) for ds in value):
118
+ entity_class = entity_type.EntityTypes['Datastream']['class']
119
+ self._datastreams = entity_list.EntityList(entity_class=entity_class, entities=value)
120
+ return
121
+ if not isinstance(value, entity_list.EntityList) \
122
+ or any((not isinstance(ds, datastream.Datastream)) for ds in value.entities):
123
+ raise ValueError('datastreams should be of list of type Datastream!')
124
+ self._datastreams = value
125
+
126
+ @property
127
+ def multi_datastreams(self):
128
+ return self._multi_datastreams
129
+
130
+ @multi_datastreams.setter
131
+ def multi_datastreams(self, values):
132
+ if values is None:
133
+ self._multi_datastreams = None
134
+ return
135
+ if isinstance(values, list) and all(isinstance(mds, multi_datastream.MultiDatastream) for mds in values):
136
+ entity_class = entity_type.EntityTypes['MultiDatastream']['class']
137
+ self._multi_datastreams = entity_list.EntityList(entity_class=entity_class, entities=values)
138
+ return
139
+ if not isinstance(values, entity_list.EntityList) or\
140
+ any((not isinstance(mds, multi_datastream.MultiDatastream)) for mds in values.entities):
141
+ raise ValueError('multi_datastreams should be a list of multi_datastreams!')
142
+ self._multi_datastreams = values
143
+
144
+ def get_datastreams(self):
145
+ result = self.service.datastreams()
146
+ result.parent = self
147
+ return result
148
+
149
+ def get_multi_datastreams(self):
150
+ result = self.service.multi_datastreams()
151
+ result.parent = self
152
+ return result
153
+
154
+ def ensure_service_on_children(self, service):
155
+ if self.datastreams is not None:
156
+ self.datastreams.set_service(service)
157
+ if self.multi_datastreams is not None:
158
+ self.multi_datastreams.set_service(service)
159
+
160
+ def __eq__(self, other):
161
+ if not super().__eq__(other):
162
+ return False
163
+ if self.name != other.name:
164
+ return False
165
+ if self.description != other.description:
166
+ return False
167
+ if self.definition != other.definition:
168
+ return False
169
+ if self.properties != other.properties:
170
+ return False
171
+ return True
172
+
173
+ def __ne__(self, other):
174
+ return not self == other
175
+
176
+ def __getstate__(self):
177
+ data = super().__getstate__()
178
+ if self.name is not None and self.name != '':
179
+ data['name'] = self.name
180
+ if self.description is not None and self.description != '':
181
+ data['description'] = self.description
182
+ if self.definition is not None and self.definition != '':
183
+ data['definition'] = self.definition
184
+ if self.properties is not None and self.properties != {}:
185
+ data['properties'] = self.properties
186
+ if self.datastreams is not None and len(self.datastreams.entities) > 0:
187
+ data['Datastreams'] = self.datastreams.__getstate__()
188
+ if self.multi_datastreams is not None and len(self.multi_datastreams.entities) > 0:
189
+ data['MultiDatastreams'] = self.multi_datastreams.__getstate__()
190
+ return data
191
+
192
+ def __setstate__(self, state):
193
+ super().__setstate__(state)
194
+ self.name = state.get("name", None)
195
+ self.description = state.get("description", None)
196
+ self.definition = state.get("definition", None)
197
+ self.properties = state.get("properties", {})
198
+ if state.get("Datastreams", None) is not None and isinstance(state["Datastreams"], list):
199
+ entity_class = entity_type.EntityTypes['Datastream']['class']
200
+ self.datastreams = utils.transform_json_to_entity_list(state['Datastreams'], entity_class)
201
+ self.datastreams.next_link = state.get('Datastreams@iot.nextLink', None)
202
+ self.datastreams.count = state.get('Datastreams@iot.count', None)
203
+ if state.get("MultiDatastreams", None) is not None and isinstance(state["MultiDatastreams"], list):
204
+ entity_class = entity_type.EntityTypes['MultiDatastream']['class']
205
+ self.multi_datastreams = utils.transform_json_to_entity_list(state['MultiDatastreams'], entity_class)
206
+ self.multi_datastreams.next_link = state.get('MultiDatastreams@iot.nextLink', None)
207
+ self.multi_datastreams.count = state.get('MultiDatastreams@iot.count', None)
208
+
209
+ def get_dao(self, service):
210
+ return ObservedPropertyDao(service)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frost_sta_client
3
- Version: 1.1.50
3
+ Version: 1.1.51
4
4
  Summary: a client library to facilitate interaction with a FROST SensorThingsAPI Server
5
5
  Home-page: https://github.com/FraunhoferIOSB/FROST-Python-Client
6
6
  Author: Fraunhofer IOSB
@@ -1,5 +1,5 @@
1
1
  frost_sta_client/__init__.py,sha256=N0Rs6kwdPcpyz0p-Tfq2PYIAIIZsMmnSC0QXus_AmP0,1789
2
- frost_sta_client/__version__.py,sha256=YlJvHmENV_oKBVhv9GKooi1RsV_49ZSoiI5TUbXJCi8,355
2
+ frost_sta_client/__version__.py,sha256=_Le1efx8vXib8fBNZnPUMf3bbBwsr5YqTKbulzxYibg,355
3
3
  frost_sta_client/utils.py,sha256=YA8B3SkG0RFFumSPPH65rJ2BHrADzKtcCKXVKAUVG54,4747
4
4
  frost_sta_client/dao/__init__.py,sha256=RKxbQ3WLVygWyz_Kb-SzO7CfUdffq7LqtJHcHSOHmgo,221
5
5
  frost_sta_client/dao/actuator.py,sha256=WxRjeetR50Pb9AbhCdtc1VRSl09pgzfA2DsPBBZy-3E,1099
@@ -17,22 +17,22 @@ frost_sta_client/dao/tasking_capability.py,sha256=cn5iG2aL2Zh74E8WRKpEfTRjupkY-4
17
17
  frost_sta_client/dao/thing.py,sha256=qPNrQjAmxrJ6dmJKVRr1eP6V9-zKVcIYr3t1DVNHtHo,1102
18
18
  frost_sta_client/model/__init__.py,sha256=LDj9AdnZ5Tjm0iZ2vTe_HyXxJ6x72GLsfKFNf5kww1U,627
19
19
  frost_sta_client/model/actuator.py,sha256=D6MWkoXDVOHd54DDggcpSki1s8aqdHZHOPnhu-rCnYg,7060
20
- frost_sta_client/model/datastream.py,sha256=tIp7egNtaLYzaNVeipVYbpA8KdULxY7704m_e-CDZto,12625
20
+ frost_sta_client/model/datastream.py,sha256=iHdNA9LzdsBlUpv-dwJ4JVfD57OuXsBs-6s2rTu_occ,12630
21
21
  frost_sta_client/model/entity.py,sha256=xf3EgxqUAg3Wk4nvZRNKkeFjYDMSS_47YPNVDVuFGO0,3671
22
22
  frost_sta_client/model/feature_of_interest.py,sha256=NYFIUZA6tVs6hK2oy7fOM4KCjLccHllIscg0M7Ycr2E,7187
23
23
  frost_sta_client/model/historical_location.py,sha256=vZFv3NtKzTsFv1fMPwMSOeHc1QogiYcCu9lfNLvui68,4630
24
24
  frost_sta_client/model/location.py,sha256=DX27Za-4ookaQlaQ6tsyDPkRW6RkFc6-oD7zvatJgGk,9278
25
- frost_sta_client/model/multi_datastream.py,sha256=6rj_8NCSbxJ8afxg8O2eBzqDpe4xcNTKZaTb8AA3zY8,14421
25
+ frost_sta_client/model/multi_datastream.py,sha256=zHtH9pAoyyq9kwUnG8cJfjct2ETEVj2yKzEqNzEqLbE,14059
26
26
  frost_sta_client/model/observation.py,sha256=YPNqH_CMfvaimkdAMtWW76-l5UIai32aej22pP3DnZ8,9221
27
- frost_sta_client/model/observedproperty.py,sha256=NeyVBDm7xyZf8nWQvAshoytaKqwNv1Jw20FOMCTyU-Q,8347
27
+ frost_sta_client/model/observedproperty.py,sha256=vPwl06fXZmC4dltN4oqrbEotd0FVpOk0KPA_8B4JdPo,8136
28
28
  frost_sta_client/model/sensor.py,sha256=ric_gEhn8oQWE7TR4Dwo1ASGysZpWJ6gsrQT4n_sgn4,8644
29
29
  frost_sta_client/model/task.py,sha256=xsNXokC2Z9GLdn9W_c9erC_yj3Duz_p5EY20HLhxX_o,4366
30
30
  frost_sta_client/model/tasking_capability.py,sha256=3aznDKyvzO4VMbuz4dLYY1oK9Ggk8fy18p9T13y05PU,7785
31
31
  frost_sta_client/model/thing.py,sha256=1F-mkQPML5mf6NkzXswuTJr8nGnDV1u8GYNj8YtNcl0,13257
32
32
  frost_sta_client/model/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- frost_sta_client/model/ext/data_array_document.py,sha256=Szvv4iHIHqQsost-ASInoTHYH7qc6qjMkgSYXJu-iYE,2201
33
+ frost_sta_client/model/ext/data_array_document.py,sha256=nsKRKWuq31j6w6_KsrpKEbLRw0FBDtMdmyK_rNl4yAQ,2126
34
34
  frost_sta_client/model/ext/data_array_value.py,sha256=uqQBZNj9RGGSMP1fuoUek4efRblCRpDkf2cl2V2haiI,6538
35
- frost_sta_client/model/ext/entity_list.py,sha256=D_5jUq4MSvbvYG9M7KfsoGpS0W0znW-Z1aSFDUJ_juA,5933
35
+ frost_sta_client/model/ext/entity_list.py,sha256=PsLCcaZ3yLRa17TuBuQMqSlPiwUC193DrDvs69Wv4xg,6176
36
36
  frost_sta_client/model/ext/entity_type.py,sha256=D-fcaPoRLGTjOCYT8MrljmCL8y4T2cWOmmN0Ra5Ettw,4285
37
37
  frost_sta_client/model/ext/unitofmeasurement.py,sha256=CyNBmwdgV5u6N8MfGLquCbpnAonUH4N1Pn3dAkPzgBU,2702
38
38
  frost_sta_client/query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -40,8 +40,8 @@ frost_sta_client/query/query.py,sha256=hXd-ffYf2HDZ5aqVA5lW5XtoijIr4-4mTfevdRDz2
40
40
  frost_sta_client/service/__init__.py,sha256=au1GqHe1OB7Iq-i90plqmIrH-7wBE7ogDoQ2uX03Fj0,109
41
41
  frost_sta_client/service/auth_handler.py,sha256=qahYUK7Z0kGvbUcdtpodIA9sngYCfJz2jqKpLVGA8Z4,1117
42
42
  frost_sta_client/service/sensorthingsservice.py,sha256=H2wM4v5oPvJ6eBfvdkbYyLI4V1vaWpbAuq-Q_fGo3-A,4621
43
- frost_sta_client-1.1.50.dist-info/licenses/LICENSE,sha256=LPNKwDiu5awG-TPd0dqYJuC7k4PBPY4LCI_O0LSpW1s,7814
44
- frost_sta_client-1.1.50.dist-info/METADATA,sha256=_puhN-FXpb5axOVuwtPXbSTy2aprSKXWeOTdx_B3ONw,5905
45
- frost_sta_client-1.1.50.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
46
- frost_sta_client-1.1.50.dist-info/top_level.txt,sha256=c35-3D_K1E_y8fcadqI3j6kGQ7HBrkOqCNie5Rv64KI,17
47
- frost_sta_client-1.1.50.dist-info/RECORD,,
43
+ frost_sta_client-1.1.51.dist-info/licenses/LICENSE,sha256=LPNKwDiu5awG-TPd0dqYJuC7k4PBPY4LCI_O0LSpW1s,7814
44
+ frost_sta_client-1.1.51.dist-info/METADATA,sha256=qh9lckmDeSvuUdrOFt51c1RlUpo75IoCc4lWwkuEANU,5905
45
+ frost_sta_client-1.1.51.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
46
+ frost_sta_client-1.1.51.dist-info/top_level.txt,sha256=c35-3D_K1E_y8fcadqI3j6kGQ7HBrkOqCNie5Rv64KI,17
47
+ frost_sta_client-1.1.51.dist-info/RECORD,,