diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2021-11-17 10:07:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 10:07:27 +0000 |
commit | 6b1cc141aeb9501aa23774056fbc7179b719e200 (patch) | |
tree | c6f323b1ca6a0a86a951358b1872db965cdfee06 /src/tox/plugin | |
parent | 84acf045fb39e642ec5e82b3824b7450c6b63225 (diff) | |
download | tox-git-6b1cc141aeb9501aa23774056fbc7179b719e200.tar.gz |
Drop python 3.6 support (#2275)
Diffstat (limited to 'src/tox/plugin')
-rw-r--r-- | src/tox/plugin/__init__.py | 2 | ||||
-rw-r--r-- | src/tox/plugin/inline.py | 7 | ||||
-rw-r--r-- | src/tox/plugin/manager.py | 7 | ||||
-rw-r--r-- | src/tox/plugin/spec.py | 10 |
4 files changed, 16 insertions, 10 deletions
diff --git a/src/tox/plugin/__init__.py b/src/tox/plugin/__init__.py index 0a41e001..3632bdbd 100644 --- a/src/tox/plugin/__init__.py +++ b/src/tox/plugin/__init__.py @@ -15,6 +15,8 @@ snippet would define a new ``--magic`` command line interface flag the user can You can define such hooks either in a package installed alongside tox or within a ``toxfile.py`` found alongside your tox configuration file (root of your project). """ +from __future__ import annotations + from typing import Any, Callable, TypeVar import pluggy diff --git a/src/tox/plugin/inline.py b/src/tox/plugin/inline.py index 177a7d22..113ddf4f 100644 --- a/src/tox/plugin/inline.py +++ b/src/tox/plugin/inline.py @@ -1,13 +1,14 @@ +from __future__ import annotations + import importlib import sys from pathlib import Path from types import ModuleType -from typing import Optional -def load_inline(path: Path) -> Optional[ModuleType]: +def load_inline(path: Path) -> ModuleType | None: # nox uses here the importlib.machinery.SourceFileLoader but I consider this similarly good, and we can keep any - # name for the tox file, it's content will always be loaded in the this module from a system point of view + # name for the tox file, its content will always be loaded in this module from a system point of view for name in ("toxfile", "☣"): candidate = path.parent / f"{name}.py" if candidate.exists(): diff --git a/src/tox/plugin/manager.py b/src/tox/plugin/manager.py index 02dbac24..c10c8282 100644 --- a/src/tox/plugin/manager.py +++ b/src/tox/plugin/manager.py @@ -1,7 +1,8 @@ """Contains the plugin manager object""" +from __future__ import annotations + from pathlib import Path from types import ModuleType -from typing import List, Optional import pluggy @@ -69,7 +70,7 @@ class Plugin: def tox_before_run_commands(self, tox_env: ToxEnv) -> None: self.manager.hook.tox_before_run_commands(tox_env=tox_env) - def tox_after_run_commands(self, tox_env: ToxEnv, exit_code: int, outcomes: List[Outcome]) -> None: + def tox_after_run_commands(self, tox_env: ToxEnv, exit_code: int, outcomes: list[Outcome]) -> None: self.manager.hook.tox_after_run_commands(tox_env=tox_env, exit_code=exit_code, outcomes=outcomes) def load_inline_plugin(self, path: Path) -> None: @@ -81,7 +82,7 @@ class Plugin: self.manager.check_pending() -def _load_inline(path: Path) -> Optional[ModuleType]: # used to be able to unregister plugin tests +def _load_inline(path: Path) -> ModuleType | None: # used to be able to unregister plugin tests return load_inline(path) diff --git a/src/tox/plugin/spec.py b/src/tox/plugin/spec.py index aa21df95..4eec8aa6 100644 --- a/src/tox/plugin/spec.py +++ b/src/tox/plugin/spec.py @@ -1,4 +1,6 @@ -from typing import Any, Callable, List, TypeVar, cast +from __future__ import annotations + +from typing import Any, Callable, TypeVar, cast import pluggy @@ -42,7 +44,7 @@ def tox_add_option(parser: ToxParser) -> None: # noqa: U100 @_spec -def tox_add_core_config(core_conf: ConfigSet, config: "Config") -> None: # noqa: U100 +def tox_add_core_config(core_conf: ConfigSet, config: Config) -> None: # noqa: U100 """ Called when the core configuration is built for a tox environment. @@ -52,7 +54,7 @@ def tox_add_core_config(core_conf: ConfigSet, config: "Config") -> None: # noqa @_spec -def tox_add_env_config(env_conf: EnvConfigSet, config: "Config") -> None: # noqa: U100 +def tox_add_env_config(env_conf: EnvConfigSet, config: Config) -> None: # noqa: U100 """ Called when configuration is built for a tox environment. @@ -71,7 +73,7 @@ def tox_before_run_commands(tox_env: ToxEnv) -> None: # noqa: U100 @_spec -def tox_after_run_commands(tox_env: ToxEnv, exit_code: int, outcomes: List[Outcome]) -> None: # noqa: U100 +def tox_after_run_commands(tox_env: ToxEnv, exit_code: int, outcomes: list[Outcome]) -> None: # noqa: U100 """ Called after the commands set is executed. |