@@ -61,7 +61,7 @@ def _validate_keys(connection_string_parts: Mapping) -> None:
61
61
]
62
62
63
63
64
- class IoTHubDevice (IoTMQTTCallback ):
64
+ class IoTHubDevice (IoTMQTTCallback ): # pylint: disable=too-many-instance-attributes
65
65
"""A device client for the Azure IoT Hub service"""
66
66
67
67
def connection_status_change (self , connected : bool ) -> None :
@@ -135,7 +135,7 @@ def device_twin_reported_updated(
135
135
reported_property_name , reported_property_value , reported_version
136
136
)
137
137
138
- def __init__ (
138
+ def __init__ ( # pylint: disable=too-many-arguments
139
139
self ,
140
140
socket ,
141
141
iface ,
@@ -168,7 +168,8 @@ def __init__(
168
168
)
169
169
except (ValueError , AttributeError ) as e :
170
170
raise ValueError (
171
- "Connection string is required and should not be empty or blank and must be supplied as a string"
171
+ "Connection string is required and should not be empty or blank and must be"
172
+ "supplied as a string"
172
173
) from e
173
174
174
175
if len (cs_args ) != len (connection_string_values ):
@@ -194,7 +195,8 @@ def __init__(
194
195
195
196
@property
196
197
def on_connection_status_changed (self ) -> Callable :
197
- """A callback method that is called when the connection status is changed. This method should have the following signature:
198
+ """A callback method that is called when the connection status is changed.
199
+ This method should have the following signature:
198
200
def connection_status_changed(connected: bool) -> None
199
201
"""
200
202
return self ._on_connection_status_changed
@@ -203,40 +205,46 @@ def connection_status_changed(connected: bool) -> None
203
205
def on_connection_status_changed (
204
206
self , new_on_connection_status_changed : Callable
205
207
) -> None :
206
- """A callback method that is called when the connection status is changed. This method should have the following signature:
208
+ """A callback method that is called when the connection status is changed.
209
+ This method should have the following signature:
207
210
def connection_status_changed(connected: bool) -> None
208
211
"""
209
212
self ._on_connection_status_changed = new_on_connection_status_changed
210
213
211
214
@property
212
215
def on_direct_method_invoked (self ) -> Callable :
213
- """A callback method that is called when a direct method is invoked. This method should have the following signature:
216
+ """A callback method that is called when a direct method is invoked.
217
+ This method should have the following signature:
214
218
def direct_method_invoked(method_name: str, payload: str) -> IoTResponse:
215
219
216
- This method returns an IoTResponse containing a status code and message from the method invocation. Set this appropriately
217
- depending on if the method was successfully handled or not. For example, if the method was handled successfully, set
218
- the code to 200 and message to "OK":
220
+ This method returns an IoTResponse containing a status code and message from the method
221
+ invocation. Set this appropriately depending on if the method was successfully handled or
222
+ not. For example, if the method was handled successfully, set the code to 200 and message
223
+ to "OK":
219
224
220
225
return IoTResponse(200, "OK")
221
226
"""
222
227
return self ._on_direct_method_invoked
223
228
224
229
@on_direct_method_invoked .setter
225
230
def on_direct_method_invoked (self , new_on_direct_method_invoked : Callable ) -> None :
226
- """A callback method that is called when a direct method is invoked. This method should have the following signature:
231
+ """A callback method that is called when a direct method is invoked.
232
+ This method should have the following signature:
227
233
def direct_method_invoked(method_name: str, payload: str) -> IoTResponse:
228
234
229
- This method returns an IoTResponse containing a status code and message from the method invocation. Set this appropriately
230
- depending on if the method was successfully handled or not. For example, if the method was handled successfully, set
231
- the code to 200 and message to "OK":
235
+ This method returns an IoTResponse containing a status code and message from the method
236
+ invocation. Set this appropriately depending on if the method was successfully handled or
237
+ not. For example, if the method was handled successfully, set the code to 200 and message
238
+ to "OK":
232
239
233
240
return IoTResponse(200, "OK")
234
241
"""
235
242
self ._on_direct_method_invoked = new_on_direct_method_invoked
236
243
237
244
@property
238
245
def on_cloud_to_device_message_received (self ) -> Callable :
239
- """A callback method that is called when a cloud to device message is received. This method should have the following signature:
246
+ """A callback method that is called when a cloud to device message is received.
247
+ This method should have the following signature:
240
248
def cloud_to_device_message_received(body: str, properties: dict) -> None:
241
249
"""
242
250
return self ._on_cloud_to_device_message_received
@@ -245,7 +253,8 @@ def cloud_to_device_message_received(body: str, properties: dict) -> None:
245
253
def on_cloud_to_device_message_received (
246
254
self , new_on_cloud_to_device_message_received : Callable
247
255
) -> None :
248
- """A callback method that is called when a cloud to device message is received. This method should have the following signature:
256
+ """A callback method that is called when a cloud to device message is received.
257
+ This method should have the following signature:
249
258
def cloud_to_device_message_received(body: str, properties: dict) -> None:
250
259
"""
251
260
self ._on_cloud_to_device_message_received = (
@@ -254,19 +263,21 @@ def cloud_to_device_message_received(body: str, properties: dict) -> None:
254
263
255
264
@property
256
265
def on_device_twin_desired_updated (self ) -> Callable :
257
- """A callback method that is called when the desired properties of the devices device twin are updated.
258
- This method should have the following signature:
259
- def device_twin_desired_updated(desired_property_name: str, desired_property_value, desired_version: int) -> None:
266
+ """A callback method that is called when the desired properties of the devices device twin
267
+ are updated. This method should have the following signature:
268
+ def device_twin_desired_updated(desired_property_name: str, desired_property_value,
269
+ desired_version: int) -> None:
260
270
"""
261
271
return self ._on_device_twin_desired_updated
262
272
263
273
@on_device_twin_desired_updated .setter
264
274
def on_device_twin_desired_updated (
265
275
self , new_on_device_twin_desired_updated : Callable
266
276
) -> None :
267
- """A callback method that is called when the desired properties of the devices device twin are updated.
268
- This method should have the following signature:
269
- def device_twin_desired_updated(desired_property_name: str, desired_property_value, desired_version: int) -> None:
277
+ """A callback method that is called when the desired properties of the devices device twin
278
+ are updated. This method should have the following signature:
279
+ def device_twin_desired_updated(desired_property_name: str, desired_property_value,
280
+ desired_version: int) -> None:
270
281
"""
271
282
self ._on_device_twin_desired_updated = new_on_device_twin_desired_updated
272
283
@@ -275,19 +286,21 @@ def device_twin_desired_updated(desired_property_name: str, desired_property_val
275
286
276
287
@property
277
288
def on_device_twin_reported_updated (self ) -> Callable :
278
- """A callback method that is called when the reported properties of the devices device twin are updated.
279
- This method should have the following signature:
280
- def device_twin_reported_updated(reported_property_name: str, reported_property_value, reported_version: int) -> None:
289
+ """A callback method that is called when the reported properties of the devices device twin
290
+ are updated. This method should have the following signature:
291
+ def device_twin_reported_updated(reported_property_name: str, reported_property_value,
292
+ reported_version: int) -> None:
281
293
"""
282
294
return self ._on_device_twin_reported_updated
283
295
284
296
@on_device_twin_reported_updated .setter
285
297
def on_device_twin_reported_updated (
286
298
self , new_on_device_twin_reported_updated : Callable
287
299
) -> None :
288
- """A callback method that is called when the reported properties of the devices device twin are updated.
289
- This method should have the following signature:
290
- def device_twin_reported_updated(reported_property_name: str, reported_property_value, reported_version: int) -> None:
300
+ """A callback method that is called when the reported properties of the devices device twin
301
+ are updated. This method should have the following signature:
302
+ def device_twin_reported_updated(reported_property_name: str, reported_property_value,
303
+ reported_version: int) -> None:
291
304
"""
292
305
self ._on_device_twin_reported_updated = new_on_device_twin_reported_updated
293
306
0 commit comments