From b366507dea5570c237245fdbf5e1ed5d4d27ed5b Mon Sep 17 00:00:00 2001 From: Jochen Vothknecht <jochen3120@gmail.com> Date: Tue, 12 Apr 2022 08:15:19 +0200 Subject: [PATCH] Reordering import --- SiliconTorch/MQTT.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SiliconTorch/MQTT.py b/SiliconTorch/MQTT.py index 9089175..4dbf9b6 100644 --- a/SiliconTorch/MQTT.py +++ b/SiliconTorch/MQTT.py @@ -1,11 +1,12 @@ -from typing import Callable import yaml import json import random import logging import paho.mqtt.client as mqtt +from typing import Callable + ######################################## #### #### @@ -372,6 +373,13 @@ class SpiderMQTT: return self.connected def publish(self, topic, payload=None, qos=0, retain=False, prettyPrintYAML=False) -> None: + + # ###################################################### + # ### USE issubclass(…) INSTEAD AND TEST FOR IT!!! ### + # ###################################################### + + # what we did here is bad style and contrary to what we want to achieve :/ + if isinstance(payload, str): pl = payload.encode('utf-8') elif isinstance(payload, (bool, int, float, complex)): -- GitLab