Skip to content

Commit

Permalink
Handle flake8-bugbear B023, rather than ignore it
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Aug 31, 2022
1 parent 59a38bd commit ef7c076
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/poetry/plugins/application_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import functools

from typing import TYPE_CHECKING

from poetry.plugins.base_plugin import BasePlugin
Expand All @@ -22,8 +24,12 @@ def commands(self) -> list[type[Command]]:
return []

def activate(self, application: Application) -> None:
def factory(command: type[Command]) -> Command:
return command()

for command in self.commands:
assert command.name is not None

application.command_loader.register_factory(
command.name, lambda: command() # noqa: B023
command.name, functools.partial(factory, command)
)

0 comments on commit ef7c076

Please sign in to comment.