Skip to content

Commit 393525f

Browse files
committed
attempting to begin to appease the linting gods
1 parent bc9582c commit 393525f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

adafruit_azureiot/base64.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
def _bytes_from_decode_data(data: str):
4747
try:
4848
return data.encode("ascii")
49-
except:
50-
raise ValueError("string argument should contain only ASCII characters")
49+
except Exception as e:
50+
raise ValueError("string argument should contain only ASCII characters") from e
5151

5252

5353
def b64encode(toencode: bytes) -> bytes:

adafruit_azureiot/device_registration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _loop_assign(self, operation_id, headers) -> str:
104104
except ValueError as error:
105105
err = "ERROR: " + str(error) + " => " + str(response)
106106
self._logger.error(err)
107-
raise DeviceRegistrationError(err)
107+
raise DeviceRegistrationError(err) from error
108108

109109
loop_try = 0
110110

@@ -225,7 +225,7 @@ def register_device(self, expiry: int) -> str:
225225
except ValueError as error:
226226
err = "ERROR: non JSON is received from " + constants.DPS_END_POINT + " => " + str(response) + " .. message : " + str(error)
227227
self._logger.error(err)
228-
raise DeviceRegistrationError(err)
228+
raise DeviceRegistrationError(err) from error
229229

230230
if "errorCode" in data:
231231
err = "DPS => " + str(data)

adafruit_azureiot/iothub_device.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def __init__(self, socket, iface, device_connection_string: str, token_expires:
146146
try:
147147
cs_args = device_connection_string.split(DELIMITER)
148148
connection_string_values = dict(arg.split(VALUE_SEPARATOR, 1) for arg in cs_args)
149-
except (ValueError, AttributeError):
150-
raise ValueError("Connection string is required and should not be empty or blank and must be supplied as a string")
149+
except (ValueError, AttributeError) as e:
150+
raise ValueError("Connection string is required and should not be empty or blank and must be supplied as a string") from e
151151

152152
if len(cs_args) != len(connection_string_values):
153153
raise ValueError("Invalid Connection String - Unable to parse")

0 commit comments

Comments
 (0)