From 9ffa8052744106eb161e21e4aef8dd89c0bc66ae Mon Sep 17 00:00:00 2001 From: Nick Stenning Date: Sun, 6 Oct 2024 14:35:35 +0200 Subject: [PATCH] Fix lint errors --- doc/conf.py | 4 ++-- honcho/command.py | 11 ++++------- honcho/environ.py | 7 ++----- honcho/export/runit.py | 5 ++--- honcho/export/supervisord.py | 3 +-- honcho/export/systemd.py | 4 +--- honcho/export/upstart.py | 4 +--- honcho/manager.py | 4 ++-- honcho/printer.py | 4 ++-- tests/conftest.py | 2 +- tests/integration/test_main.py | 3 ++- tests/integration/test_start.py | 2 +- tests/test_environ.py | 4 ++-- tests/test_export_base.py | 7 ++----- tests/test_export_runit.py | 4 ++-- tests/test_export_supervisord.py | 3 +-- tests/test_export_systemd.py | 6 ++---- tests/test_export_upstart.py | 6 ++---- tests/test_invocation.py | 6 ++---- tests/test_manager.py | 7 +++---- tests/test_printer.py | 3 ++- tests/test_process.py | 3 ++- 22 files changed, 41 insertions(+), 61 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index c2a1aa6..49a7fe8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,3 +1,5 @@ +from honcho import __version__ + # -*- coding: utf-8 -*- # # honcho documentation build configuration file, created by @@ -11,7 +13,6 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -48,7 +49,6 @@ # built documents. # # The short X.Y version. -from honcho import __version__ version = __version__ # The full version, including alpha/beta/rc tags. release = __version__ diff --git a/honcho/command.py b/honcho/command.py index 64ec5dd..0644173 100644 --- a/honcho/command.py +++ b/honcho/command.py @@ -3,18 +3,15 @@ import logging import os import shlex -import sys import signal -from collections import ChainMap -from collections import OrderedDict -from collections import defaultdict +import sys +from collections import ChainMap, OrderedDict, defaultdict -from honcho import __version__ +from honcho import __version__, compat, environ from honcho.environ import Env -from honcho.process import Popen from honcho.manager import Manager from honcho.printer import Printer -from honcho import compat, environ +from honcho.process import Popen if sys.version_info < (3, 10): from backports.entry_points_selectable import entry_points diff --git a/honcho/environ.py b/honcho/environ.py index 0c22ab8..243ea04 100644 --- a/honcho/environ.py +++ b/honcho/environ.py @@ -1,10 +1,7 @@ -from collections import OrderedDict -from collections import defaultdict -from collections import namedtuple -import shlex import os import re - +import shlex +from collections import OrderedDict, defaultdict, namedtuple PROCFILE_LINE = re.compile(r'^([A-Za-z0-9_-]+):\s*(.+)$') diff --git a/honcho/export/runit.py b/honcho/export/runit.py index 28784be..02ef3a3 100644 --- a/honcho/export/runit.py +++ b/honcho/export/runit.py @@ -1,9 +1,8 @@ import os + import jinja2 -from honcho.export.base import BaseExport -from honcho.export.base import File -from honcho.export.base import dashrepl +from honcho.export.base import BaseExport, File, dashrepl class Export(BaseExport): diff --git a/honcho/export/supervisord.py b/honcho/export/supervisord.py index f784afc..7551bdc 100644 --- a/honcho/export/supervisord.py +++ b/honcho/export/supervisord.py @@ -1,7 +1,6 @@ import jinja2 -from honcho.export.base import BaseExport -from honcho.export.base import File +from honcho.export.base import BaseExport, File class Export(BaseExport): diff --git a/honcho/export/systemd.py b/honcho/export/systemd.py index 57006b7..469c61c 100644 --- a/honcho/export/systemd.py +++ b/honcho/export/systemd.py @@ -2,9 +2,7 @@ import jinja2 -from honcho.export.base import BaseExport -from honcho.export.base import File -from honcho.export.base import dashrepl +from honcho.export.base import BaseExport, File, dashrepl class Export(BaseExport): diff --git a/honcho/export/upstart.py b/honcho/export/upstart.py index 0aa00f4..7ca2581 100644 --- a/honcho/export/upstart.py +++ b/honcho/export/upstart.py @@ -2,9 +2,7 @@ import jinja2 -from honcho.export.base import BaseExport -from honcho.export.base import File -from honcho.export.base import dashrepl +from honcho.export.base import BaseExport, File, dashrepl class Export(BaseExport): diff --git a/honcho/manager.py b/honcho/manager.py index f1fb538..9308cfd 100644 --- a/honcho/manager.py +++ b/honcho/manager.py @@ -1,13 +1,13 @@ import datetime -import queue import multiprocessing +import queue import signal import sys from .colour import get_colours from .compat import ProcessManager +from .printer import Message, Printer from .process import Process -from .printer import Printer, Message KILL_WAIT = 5 SIGNALS = { diff --git a/honcho/printer.py b/honcho/printer.py index 94f7ab2..e91c085 100644 --- a/honcho/printer.py +++ b/honcho/printer.py @@ -1,5 +1,5 @@ -from collections import namedtuple import sys +from collections import namedtuple from .compat import ON_WINDOWS @@ -76,7 +76,7 @@ def _colour_string(colour, s): try: import colorama except ImportError: - def _colour_string(colour, s): # noqa + def _colour_string(colour, s): return s else: colorama.init() diff --git a/tests/conftest.py b/tests/conftest.py index d85097d..abb78af 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,7 +31,7 @@ def path(self, *args): def run_honcho(self, args): result = subprocess.run( - ['honcho'] + args, + ['honcho', *args], cwd=self.root, stdout=PIPE, stderr=PIPE, diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py index fb9455b..71ac85f 100644 --- a/tests/integration/test_main.py +++ b/tests/integration/test_main.py @@ -1,6 +1,7 @@ -import pytest import textwrap +import pytest + @pytest.mark.parametrize('testenv', [{ 'Procfile': textwrap.dedent(""" diff --git a/tests/integration/test_start.py b/tests/integration/test_start.py index 5fe2d0f..d1a3134 100644 --- a/tests/integration/test_start.py +++ b/tests/integration/test_start.py @@ -1,5 +1,5 @@ -import textwrap import sys +import textwrap import pytest diff --git a/tests/test_environ.py b/tests/test_environ.py index 459a673..b9873c5 100644 --- a/tests/test_environ.py +++ b/tests/test_environ.py @@ -88,8 +88,8 @@ # Unicode values r""" MYVAR=⋃ñᴉ—☪ó∂ǝ - """, - {'MYVAR': '⋃ñᴉ—☪ó∂ǝ'} + """, # noqa: RUF001 + {'MYVAR': '⋃ñᴉ—☪ó∂ǝ'} # noqa: RUF001 ], [ # Unicode keys diff --git a/tests/test_export_base.py b/tests/test_export_base.py index 5aa07f6..6749c25 100644 --- a/tests/test_export_base.py +++ b/tests/test_export_base.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- -from mock import Mock -from mock import patch import pytest +from mock import Mock, patch -from honcho.export.base import BaseExport -from honcho.export.base import dashrepl -from honcho.export.base import percentescape +from honcho.export.base import BaseExport, dashrepl, percentescape class GiraffeExport(BaseExport): diff --git a/tests/test_export_runit.py b/tests/test_export_runit.py index 52fe60b..dc7049b 100644 --- a/tests/test_export_runit.py +++ b/tests/test_export_runit.py @@ -1,7 +1,7 @@ import collections -from mock import patch import pytest +from mock import patch from honcho.export.runit import Export @@ -12,7 +12,7 @@ class TestExportRunit(object): @pytest.fixture(autouse=True) - def exporter(self, request): # noqa + def exporter(self, request): self.export = Export() get_template_patcher = patch.object(Export, 'get_template') diff --git a/tests/test_export_supervisord.py b/tests/test_export_supervisord.py index 3c87518..e8de032 100644 --- a/tests/test_export_supervisord.py +++ b/tests/test_export_supervisord.py @@ -1,5 +1,4 @@ -from mock import MagicMock -from mock import patch +from mock import MagicMock, patch from honcho.export.supervisord import Export diff --git a/tests/test_export_systemd.py b/tests/test_export_systemd.py index f8242d9..c3768c2 100644 --- a/tests/test_export_systemd.py +++ b/tests/test_export_systemd.py @@ -1,9 +1,7 @@ import collections -from mock import MagicMock -from mock import call -from mock import patch import pytest +from mock import MagicMock, call, patch from honcho.export.systemd import Export @@ -17,7 +15,7 @@ class TestExportSystemd(object): @pytest.fixture(autouse=True) - def exporter(self, request): # noqa + def exporter(self, request): self.export = Export() self.master = MagicMock() diff --git a/tests/test_export_upstart.py b/tests/test_export_upstart.py index 4b418b6..4d74a4e 100644 --- a/tests/test_export_upstart.py +++ b/tests/test_export_upstart.py @@ -1,9 +1,7 @@ import collections -from mock import MagicMock -from mock import call -from mock import patch import pytest +from mock import MagicMock, call, patch from honcho.export.upstart import Export @@ -17,7 +15,7 @@ class TestExportUpstart(object): @pytest.fixture(autouse=True) - def exporter(self, request): # noqa + def exporter(self, request): self.export = Export() self.master = MagicMock() diff --git a/tests/test_invocation.py b/tests/test_invocation.py index 208ba25..59b69a4 100644 --- a/tests/test_invocation.py +++ b/tests/test_invocation.py @@ -1,8 +1,6 @@ -import sys -import subprocess import re - -import pytest +import subprocess +import sys def test_runpy_invoke(): diff --git a/tests/test_manager.py b/tests/test_manager.py index 0e3fc89..d7ed172 100644 --- a/tests/test_manager.py +++ b/tests/test_manager.py @@ -1,12 +1,11 @@ import datetime -import queue import multiprocessing +import queue import pytest +from honcho.manager import SYSTEM_PRINTER_NAME, Manager from honcho.printer import Message -from honcho.manager import Manager -from honcho.manager import SYSTEM_PRINTER_NAME HISTORIES = { 'one': { @@ -191,7 +190,7 @@ def find_line(self, data): class TestManager(object): @pytest.fixture(autouse=True) - def printer(self): # noqa + def printer(self): self.p = FakePrinter() self.m = Manager(printer=self.p) self.m._clock = FakeClock() diff --git a/tests/test_printer.py b/tests/test_printer.py index 7751ef1..96a8769 100644 --- a/tests/test_printer.py +++ b/tests/test_printer.py @@ -1,7 +1,8 @@ import datetime + import pytest -from honcho.printer import Printer, Message +from honcho.printer import Message, Printer def fake_message(data, **kwargs): diff --git a/tests/test_process.py b/tests/test_process.py index b2a8273..aeb2e9b 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1,4 +1,5 @@ import datetime + import pytest from honcho.process import Process @@ -82,7 +83,7 @@ def close(self): class TestProcess(object): @pytest.fixture(autouse=True) - def queue(self): # noqa + def queue(self): self.q = FakeQueue() def test_ctor_cmd(self):