diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a68f41a5..1bd27173 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: # Autoformat: Python code - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black @@ -64,7 +64,7 @@ repos: # Lint: Python code - repo: https://github.com/pycqa/flake8 - rev: "6.1.0" + rev: "7.0.0" hooks: - id: flake8 diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index ac520394..f69aceb8 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -42,6 +42,7 @@ can also pass a branch name such as 'main' or a commit hash. """ + import logging import multiprocessing import os diff --git a/integration-tests/plugins/simplest/tljh_simplest.py b/integration-tests/plugins/simplest/tljh_simplest.py index 015b5040..ff433f85 100644 --- a/integration-tests/plugins/simplest/tljh_simplest.py +++ b/integration-tests/plugins/simplest/tljh_simplest.py @@ -1,6 +1,7 @@ """ Simplest plugin that exercises all the hooks defined in tljh/hooks.py. """ + from tljh.hooks import hookimpl diff --git a/integration-tests/test_bootstrap.py b/integration-tests/test_bootstrap.py index 09ae1405..eac9c923 100644 --- a/integration-tests/test_bootstrap.py +++ b/integration-tests/test_bootstrap.py @@ -9,6 +9,7 @@ first two could be more like unit tests. Ideally, this file is significantly reduced. """ + import concurrent.futures import os import subprocess diff --git a/integration-tests/test_proxy.py b/integration-tests/test_proxy.py index cc9d7662..e1d376cb 100644 --- a/integration-tests/test_proxy.py +++ b/integration-tests/test_proxy.py @@ -1,4 +1,5 @@ """tests for the proxy""" + import os import shutil import ssl diff --git a/integration-tests/test_simplest_plugin.py b/integration-tests/test_simplest_plugin.py index 96eb0a50..9c2337b3 100644 --- a/integration-tests/test_simplest_plugin.py +++ b/integration-tests/test_simplest_plugin.py @@ -2,6 +2,7 @@ Test the plugin in integration-tests/plugins/simplest that makes use of all tljh recognized plugin hooks that are defined in tljh/hooks.py. """ + import os import subprocess diff --git a/tests/conftest.py b/tests/conftest.py index cf765b9e..106d5345 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """pytest fixtures""" + import os import types from importlib import reload diff --git a/tests/test_conda.py b/tests/test_conda.py index 6d445955..397499e0 100644 --- a/tests/test_conda.py +++ b/tests/test_conda.py @@ -1,6 +1,7 @@ """ Test conda commandline wrappers """ + import os import subprocess import tempfile diff --git a/tests/test_installer.py b/tests/test_installer.py index 07081e40..f06bb6ec 100644 --- a/tests/test_installer.py +++ b/tests/test_installer.py @@ -1,6 +1,7 @@ """ Unit test functions in installer.py """ + import json import os from subprocess import PIPE, run diff --git a/tests/test_migrator.py b/tests/test_migrator.py index 87275f6b..91821a87 100644 --- a/tests/test_migrator.py +++ b/tests/test_migrator.py @@ -1,6 +1,7 @@ """ Unit test functions in installer.py """ + import os from datetime import date diff --git a/tests/test_normalize.py b/tests/test_normalize.py index fe7c6236..d408c3fb 100644 --- a/tests/test_normalize.py +++ b/tests/test_normalize.py @@ -1,6 +1,7 @@ """ Test functions for normalizing various kinds of values """ + from tljh.normalize import generate_system_username diff --git a/tests/test_traefik.py b/tests/test_traefik.py index f9502662..9b0c8f8c 100644 --- a/tests/test_traefik.py +++ b/tests/test_traefik.py @@ -1,4 +1,5 @@ """Test traefik configuration""" + import os import pytest diff --git a/tests/test_user.py b/tests/test_user.py index 5bda68da..148e1740 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -1,6 +1,7 @@ """ Test wrappers in tljw.user module """ + import grp import os import os.path diff --git a/tljh/apt.py b/tljh/apt.py index b5b0845b..d746f456 100644 --- a/tljh/apt.py +++ b/tljh/apt.py @@ -1,6 +1,7 @@ """ Utilities for working with the apt package manager """ + import os import subprocess diff --git a/tljh/conda.py b/tljh/conda.py index a543645d..49737c40 100644 --- a/tljh/conda.py +++ b/tljh/conda.py @@ -1,6 +1,7 @@ """ Wrap conda commandline program """ + import contextlib import hashlib import json diff --git a/tljh/hooks.py b/tljh/hooks.py index ddaa2a31..8bdaf790 100644 --- a/tljh/hooks.py +++ b/tljh/hooks.py @@ -1,6 +1,7 @@ """ Hook specifications that pluggy plugins can override """ + import pluggy hookspec = pluggy.HookspecMarker("tljh") diff --git a/tljh/log.py b/tljh/log.py index ed7eca41..7a0d5e71 100644 --- a/tljh/log.py +++ b/tljh/log.py @@ -1,4 +1,5 @@ """Setup tljh logging""" + import logging import os diff --git a/tljh/normalize.py b/tljh/normalize.py index 01d1777a..4f4c9e10 100644 --- a/tljh/normalize.py +++ b/tljh/normalize.py @@ -1,6 +1,7 @@ """ Functions to normalize various inputs """ + import hashlib diff --git a/tljh/systemd.py b/tljh/systemd.py index f274fab5..6bfaf1b8 100644 --- a/tljh/systemd.py +++ b/tljh/systemd.py @@ -3,6 +3,7 @@ If we use a debian package instead, we can get rid of all this code. """ + import os import subprocess diff --git a/tljh/traefik.py b/tljh/traefik.py index 4ea0d49a..a19a3deb 100644 --- a/tljh/traefik.py +++ b/tljh/traefik.py @@ -1,4 +1,5 @@ """Traefik installation and setup""" + import hashlib import io import logging diff --git a/tljh/user.py b/tljh/user.py index f5ed4ca8..b03903f1 100644 --- a/tljh/user.py +++ b/tljh/user.py @@ -3,6 +3,7 @@ Supports minimal user & group management """ + import grp import pwd import subprocess diff --git a/tljh/utils.py b/tljh/utils.py index 8ab1ca8c..fceec705 100644 --- a/tljh/utils.py +++ b/tljh/utils.py @@ -1,6 +1,7 @@ """ Miscellaneous functions useful in at least two places unrelated to each other """ + import logging import re import subprocess diff --git a/tljh/yaml.py b/tljh/yaml.py index e51381e0..daff06bd 100644 --- a/tljh/yaml.py +++ b/tljh/yaml.py @@ -3,6 +3,7 @@ ensures the same yaml settings for reading/writing throughout tljh """ + from ruamel.yaml import YAML from ruamel.yaml.composer import Composer