From 6a582aae0dcaf3a3bcca4c405a9c61546ab4e0f5 Mon Sep 17 00:00:00 2001 From: Ellis Percival <flyte@failcode.co.uk> Date: Mon, 18 Jan 2021 19:55:31 +0000 Subject: [PATCH] Change gcd import --- pi_mqtt_gpio/server.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pi_mqtt_gpio/server.py b/pi_mqtt_gpio/server.py index c448af3..e43164d 100644 --- a/pi_mqtt_gpio/server.py +++ b/pi_mqtt_gpio/server.py @@ -2,26 +2,24 @@ import argparse import json import logging import logging.config -import yaml -import sys import socket import ssl -from time import sleep, time -from importlib import import_module -from hashlib import sha1 - -import threading # For callback functions -from fractions import gcd # for calculating the callback periodic time +import sys +import threading from functools import reduce +from hashlib import sha1 +from importlib import import_module +from math import gcd +from time import sleep, time -import paho.mqtt.client as mqtt import cerberus +import paho.mqtt.client as mqtt +import yaml from pi_mqtt_gpio import CONFIG_SCHEMA -from pi_mqtt_gpio.modules import PinPullup, PinDirection, InterruptEdge, BASE_SCHEMA +from pi_mqtt_gpio.modules import BASE_SCHEMA, InterruptEdge, PinDirection, PinPullup from pi_mqtt_gpio.scheduler import Scheduler, Task - LOG_LEVEL_MAP = { mqtt.MQTT_LOG_INFO: logging.INFO, mqtt.MQTT_LOG_NOTICE: logging.INFO, @@ -317,7 +315,7 @@ def install_missing_requirements(module): if pkgs_installed.find(pkg_resources.Requirement.parse(req)) is None: pkgs_required.append(req) if pkgs_required: - from subprocess import check_call, CalledProcessError + from subprocess import CalledProcessError, check_call try: check_call([sys.executable, "-m", "pip", "install"] + pkgs_required) -- GitLab