From 9c2331f84b09a4be52453a1027c75ec73562f51b Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Sat, 22 Jul 2023 22:03:18 +0200 Subject: [PATCH] refactor: minor clean-up Remove unused imports; sort imports and globals; rename function Signed-off-by: Christopher Arndt --- matrixchat-notify.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/matrixchat-notify.py b/matrixchat-notify.py index f5578ba..54fc5b9 100755 --- a/matrixchat-notify.py +++ b/matrixchat-notify.py @@ -10,12 +10,12 @@ Requires: import argparse import asyncio -import logging import json +import logging import os import sys from distutils.util import strtobool -from os.path import exists, isdir, join +from os.path import exists from string import Template from nio import AsyncClient, LoginResponse @@ -24,7 +24,6 @@ PROG = "matrixchat-notify" CONFIG_FILENAME = f"{PROG}-config.json" DEFAULT_TEMPLATE = "${DRONE_BUILD_STATUS}" DEFAULT_HOMESERVER = "https://matrix.org" -log = logging.getLogger(PROG) SETTINGS_KEYS = ( "accesstoken", "deviceid", @@ -36,6 +35,7 @@ SETTINGS_KEYS = ( "template", "userid", ) +log = logging.getLogger(PROG) def tobool(s): @@ -45,7 +45,7 @@ def tobool(s): return False -def read_config_from_file(filename): +def read_config_from_file_and_env(filename): config = {} if exists(filename): @@ -148,7 +148,7 @@ def main(args=None): ) try: - config = read_config_from_file(args.config) + config = read_config_from_file_and_env(args.config) except Exception as exc: return f"Could not parse configuration: {exc}"