Skip to content

Commit

Permalink
Fix linting errors for pylint 3
Browse files Browse the repository at this point in the history
  • Loading branch information
enpaul committed Aug 20, 2024
1 parent d816678 commit 863f88d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# --disable=W"
disable=logging-fstring-interpolation
,logging-format-interpolation
,bad-continuation
,line-too-long
,ungrouped-imports
,typecheck
Expand Down
33 changes: 16 additions & 17 deletions tox_poetry_installer/hooks/_tox_on_install_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -280,23 +295,7 @@ def logged_install(dependency: _poetry.PoetryPackage) -> None:
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:
Expand Down

0 comments on commit 863f88d

Please sign in to comment.