mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
adjust global variable definition for new pyflakes
the original code was only passing pyflakes by accident due to __future__.annotations
This commit is contained in:
parent
c48217e1fc
commit
628aece714
1 changed files with 11 additions and 12 deletions
|
|
@ -45,8 +45,7 @@ SERIAL_RETRY_ERRNOS = {
|
||||||
# noise in diffs.
|
# noise in diffs.
|
||||||
}
|
}
|
||||||
|
|
||||||
_mp_plugins: Checkers
|
_mp: tuple[Checkers, argparse.Namespace] | None = None
|
||||||
_mp_options: argparse.Namespace
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
@ -54,31 +53,31 @@ def _mp_prefork(
|
||||||
plugins: Checkers, options: argparse.Namespace
|
plugins: Checkers, options: argparse.Namespace
|
||||||
) -> Generator[None]:
|
) -> Generator[None]:
|
||||||
# we can save significant startup work w/ `fork` multiprocessing
|
# we can save significant startup work w/ `fork` multiprocessing
|
||||||
global _mp_plugins, _mp_options
|
global _mp
|
||||||
_mp_plugins, _mp_options = plugins, options
|
_mp = plugins, options
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
del _mp_plugins, _mp_options
|
_mp = None
|
||||||
|
|
||||||
|
|
||||||
def _mp_init(argv: Sequence[str]) -> None:
|
def _mp_init(argv: Sequence[str]) -> None:
|
||||||
global _mp_plugins, _mp_options
|
global _mp
|
||||||
|
|
||||||
# Ensure correct signaling of ^C using multiprocessing.Pool.
|
# Ensure correct signaling of ^C using multiprocessing.Pool.
|
||||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
|
||||||
try:
|
# for `fork` this'll already be set
|
||||||
# for `fork` this'll already be set
|
if _mp is None:
|
||||||
_mp_plugins, _mp_options # noqa: B018
|
|
||||||
except NameError:
|
|
||||||
plugins, options = parse_args(argv)
|
plugins, options = parse_args(argv)
|
||||||
_mp_plugins, _mp_options = plugins.checkers, options
|
_mp = plugins.checkers, options
|
||||||
|
|
||||||
|
|
||||||
def _mp_run(filename: str) -> tuple[str, Results, dict[str, int]]:
|
def _mp_run(filename: str) -> tuple[str, Results, dict[str, int]]:
|
||||||
|
assert _mp is not None, _mp
|
||||||
|
plugins, options = _mp
|
||||||
return FileChecker(
|
return FileChecker(
|
||||||
filename=filename, plugins=_mp_plugins, options=_mp_options
|
filename=filename, plugins=plugins, options=options
|
||||||
).run_checks()
|
).run_checks()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue