From 863f88d63c05ed3a6771dba58adb34fe64562f51 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:02:12 -0400 Subject: [PATCH] Fix linting errors for pylint 3 --- .pylintrc | 1 - .../hooks/_tox_on_install_helpers.py | 33 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.pylintrc b/.pylintrc index a1f7205..69eb0d3 100644 --- a/.pylintrc +++ b/.pylintrc @@ -11,7 +11,6 @@ # --disable=W" disable=logging-fstring-interpolation ,logging-format-interpolation - ,bad-continuation ,line-too-long ,ungrouped-imports ,typecheck diff --git a/tox_poetry_installer/hooks/_tox_on_install_helpers.py b/tox_poetry_installer/hooks/_tox_on_install_helpers.py index eefe0dc..d93e6d2 100644 --- a/tox_poetry_installer/hooks/_tox_on_install_helpers.py +++ b/tox_poetry_installer/hooks/_tox_on_install_helpers.py @@ -246,6 +246,21 @@ def find_dev_deps( return dedupe_packages(dev_group_deps + legacy_dev_group_deps) +@contextlib.contextmanager +def _optional_parallelize(parallels: int): + """A bit of cheat, really + + A context manager that exposes a common interface for the caller that optionally + enables/disables the usage of the parallel thread pooler depending on the value of + the ``parallels`` parameter. + """ + if parallels > 0: + with concurrent.futures.ThreadPoolExecutor(max_workers=parallels) as executor: + yield executor.submit + else: + yield lambda func, arg: func(arg) + + def install_package( poetry: "_poetry.Poetry", venv: ToxVirtualEnv, @@ -280,23 +295,7 @@ def install_package( end = datetime.now() logger.debug(f"Finished installing {dependency} in {end - start}") - @contextlib.contextmanager - def _optional_parallelize(): - """A bit of cheat, really - - A context manager that exposes a common interface for the caller that optionally - enables/disables the usage of the parallel thread pooler depending on the value of - the ``parallels`` parameter. - """ - if parallels > 0: - with concurrent.futures.ThreadPoolExecutor( - max_workers=parallels - ) as executor: - yield executor.submit - else: - yield lambda func, arg: func(arg) - - with _optional_parallelize() as executor: + with _optional_parallelize(parallels) as executor: futures = [] for dependency in packages: if dependency not in installed: