From 37b8ece1c498b5c19f2cfbe920019beb6b3f75a3 Mon Sep 17 00:00:00 2001 From: Anatoliy Udarczev Date: Wed, 16 Oct 2024 15:28:20 +0300 Subject: [PATCH] Fix code quality --- docs/source/conf.py | 2 +- setup_bdist_msi.py | 13 ++++++------- tests/test_util.py | 3 ++- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d962d35..dcd5520 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -10,8 +10,8 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os import importlib.metadata +import os import sys package_root = os.path.abspath("../..") diff --git a/setup_bdist_msi.py b/setup_bdist_msi.py index 4b6e858..f5a79eb 100644 --- a/setup_bdist_msi.py +++ b/setup_bdist_msi.py @@ -3,7 +3,6 @@ # NOTE: isort must not change this import order: # isort: skip_file -import os import re import sys @@ -15,8 +14,8 @@ # Check for Windows MSI Setup if "bdist_msi" not in sys.argv: # or len(sys.argv) != 2: raise RuntimeError( - "This setup.py variant is only for creating 'bdist_msi' targets: {}\n" - "Example `{} bdist_msi`".format(sys.argv, sys.argv[0]) + f"This setup.py variant is only for creating 'bdist_msi' targets: {sys.argv}\n" + f"Example `{sys.argv[0]} bdist_msi`" ) org_version = __version__ @@ -54,12 +53,12 @@ patch = int(patch) alpha = 0 -version = "{}.{}.{}.{}".format(major, minor, patch, alpha) -print("Version {}, using {}".format(org_version, version)) +version = f"{major}.{minor}.{patch}.{alpha}" +print(f"Version {org_version}, using {version}") try: - readme = open("README.md", "rt").read() -except IOError: + readme = open("README.md").read() +except OSError: readme = "(readme not found. Running from tox/setup.py test?)" # These dependencies are for plain WsgiDAV: diff --git a/tests/test_util.py b/tests/test_util.py index 3f1d27c..2e56c3b 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -7,9 +7,10 @@ import logging.handlers import sys import unittest -from lxml import etree from io import StringIO +from lxml import etree + from wsgidav import xml_tools from wsgidav.util import ( BASE_LOGGER_NAME,