Skip to content

Commit 0401852

Browse files
committed
Fix issues with using multiple f-strings without addition
1 parent c648cc1 commit 0401852

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

adafruit_azureiot/device_registration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _connect_to_mqtt(self) -> None:
115115
self._mqtt.loop()
116116

117117
self._logger.info(
118-
f" - device_registration :: connect :: on_connect must be fired. Connected ?"
118+
" - device_registration :: connect :: on_connect must be fired. Connected ?"
119119
f"{self._mqtt.is_connected()}"
120120
)
121121

@@ -149,7 +149,7 @@ def _start_registration(self) -> None:
149149
def _wait_for_operation(self) -> None:
150150
message = json.dumps({"operationId": self._operation_id})
151151
self._mqtt.publish(
152-
f"$dps/registrations/GET/iotdps-get-operationstatus/?$rid="
152+
"$dps/registrations/GET/iotdps-get-operationstatus/?$rid="
153153
f"{self._device_id}&operationId={self._operation_id}",
154154
message,
155155
)
@@ -180,7 +180,7 @@ def register_device(self, expiry: int) -> str:
180180

181181
username = (
182182
f"{self._id_scope}/registrations/{self._device_id}/api-version="
183-
f"{constants.DPS_API_VERSION}"
183+
+ f"{constants.DPS_API_VERSION}"
184184
)
185185

186186
# pylint: disable=C0103
@@ -191,7 +191,7 @@ def register_device(self, expiry: int) -> str:
191191
sig_encoded = quote(sig_no_encode, "~()*!.'")
192192
auth_string = (
193193
f"SharedAccessSignature sr={sr}&sig={sig_encoded}&se={expiry}"
194-
f"&skn=registration"
194+
"&skn=registration"
195195
)
196196

197197
MQTT.set_socket(self._socket, self._iface)

adafruit_azureiot/iot_mqtt.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ def _gen_sas_token(self) -> str:
121121
def _create_mqtt_client(self) -> None:
122122
MQTT.set_socket(self._socket, self._iface)
123123

124+
log_text = (
125+
f"- iot_mqtt :: _on_connect :: username = {self._username}, password = "
126+
+ f"{self._passwd}"
127+
)
124128
self._logger.debug(
125-
str.replace(
126-
f"- iot_mqtt :: _on_connect :: username = {self._username}, password ="
127-
f"{self._passwd}",
129+
log_text.replace(
128130
"%",
129131
"%%",
130132
)

0 commit comments

Comments
 (0)