diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-05 11:03:23 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-05 11:09:21 +0300 |
commit | 878465276c7236ff9b42f47ebe8ba9294bca469a (patch) | |
tree | 35310d2046b342060e08d45598639e981afcef33 | |
parent | df380d8d58748e4375664b1a5fe521cd717db4a9 (diff) | |
download | ydb-878465276c7236ff9b42f47ebe8ba9294bca469a.tar.gz |
Intermediate changes
-rw-r--r-- | contrib/python/pluggy/py3/.dist-info/METADATA | 17 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/README.rst | 15 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/__init__.py | 28 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_callers.py | 3 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_hooks.py | 36 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_manager.py | 11 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_result.py | 1 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_tracing.py | 1 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/pluggy/_version.py | 4 | ||||
-rw-r--r-- | contrib/python/pluggy/py3/ya.make | 2 |
10 files changed, 85 insertions, 33 deletions
diff --git a/contrib/python/pluggy/py3/.dist-info/METADATA b/contrib/python/pluggy/py3/.dist-info/METADATA index c4c3312518..2d697b0d72 100644 --- a/contrib/python/pluggy/py3/.dist-info/METADATA +++ b/contrib/python/pluggy/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pluggy -Version: 1.4.0 +Version: 1.5.0 Summary: plugin and hook calling mechanisms for python Home-page: https://github.com/pytest-dev/pluggy Author: Holger Krekel @@ -138,3 +138,18 @@ Running this directly gets us:: http://doc.devpi.net .. _read the docs: https://pluggy.readthedocs.io/en/latest/ + + +Support pluggy +-------------- + +`Open Collective`_ is an online funding platform for open and transparent communities. +It provides tools to raise money and share your finances in full transparency. + +It is the platform of choice for individuals and companies that want to make one-time or +monthly donations directly to the project. + +``pluggy`` is part of the ``pytest-dev`` project, see more details in the `pytest collective`_. + +.. _Open Collective: https://opencollective.com +.. _pytest collective: https://opencollective.com/pytest diff --git a/contrib/python/pluggy/py3/README.rst b/contrib/python/pluggy/py3/README.rst index 3496617e1e..7a58c1b9c8 100644 --- a/contrib/python/pluggy/py3/README.rst +++ b/contrib/python/pluggy/py3/README.rst @@ -99,3 +99,18 @@ Running this directly gets us:: http://doc.devpi.net .. _read the docs: https://pluggy.readthedocs.io/en/latest/ + + +Support pluggy +-------------- + +`Open Collective`_ is an online funding platform for open and transparent communities. +It provides tools to raise money and share your finances in full transparency. + +It is the platform of choice for individuals and companies that want to make one-time or +monthly donations directly to the project. + +``pluggy`` is part of the ``pytest-dev`` project, see more details in the `pytest collective`_. + +.. _Open Collective: https://opencollective.com +.. _pytest collective: https://opencollective.com/pytest diff --git a/contrib/python/pluggy/py3/pluggy/__init__.py b/contrib/python/pluggy/py3/pluggy/__init__.py index 2adf9454f8..36ce168062 100644 --- a/contrib/python/pluggy/py3/pluggy/__init__.py +++ b/contrib/python/pluggy/py3/pluggy/__init__.py @@ -22,18 +22,16 @@ __all__ = [ "PluggyTeardownRaisedWarning", ] -from ._manager import PluginManager, PluginValidationError -from ._result import HookCallError, Result -from ._hooks import ( - HookspecMarker, - HookimplMarker, - HookCaller, - HookRelay, - HookspecOpts, - HookimplOpts, - HookImpl, -) -from ._warnings import ( - PluggyWarning, - PluggyTeardownRaisedWarning, -) +from ._hooks import HookCaller +from ._hooks import HookImpl +from ._hooks import HookimplMarker +from ._hooks import HookimplOpts +from ._hooks import HookRelay +from ._hooks import HookspecMarker +from ._hooks import HookspecOpts +from ._manager import PluginManager +from ._manager import PluginValidationError +from ._result import HookCallError +from ._result import Result +from ._warnings import PluggyTeardownRaisedWarning +from ._warnings import PluggyWarning diff --git a/contrib/python/pluggy/py3/pluggy/_callers.py b/contrib/python/pluggy/py3/pluggy/_callers.py index 787f56bac2..d01f925cca 100644 --- a/contrib/python/pluggy/py3/pluggy/_callers.py +++ b/contrib/python/pluggy/py3/pluggy/_callers.py @@ -1,9 +1,9 @@ """ Call loop machinery """ + from __future__ import annotations -import warnings from typing import cast from typing import Generator from typing import Mapping @@ -11,6 +11,7 @@ from typing import NoReturn from typing import Sequence from typing import Tuple from typing import Union +import warnings from ._hooks import HookImpl from ._result import HookCallError diff --git a/contrib/python/pluggy/py3/pluggy/_hooks.py b/contrib/python/pluggy/py3/pluggy/_hooks.py index 7c8420f4de..362d791823 100644 --- a/contrib/python/pluggy/py3/pluggy/_hooks.py +++ b/contrib/python/pluggy/py3/pluggy/_hooks.py @@ -1,11 +1,11 @@ """ Internal hook annotation, representation and calling machinery. """ + from __future__ import annotations import inspect import sys -import warnings from types import ModuleType from typing import AbstractSet from typing import Any @@ -23,6 +23,7 @@ from typing import TYPE_CHECKING from typing import TypedDict from typing import TypeVar from typing import Union +import warnings from ._result import Result @@ -47,6 +48,11 @@ class HookspecOpts(TypedDict): historic: bool #: Whether the hook :ref:`warns when implemented <warn_on_impl>`. warn_on_impl: Warning | None + #: Whether the hook warns when :ref:`certain arguments are requested + #: <warn_on_impl>`. + #: + #: .. versionadded:: 1.5 + warn_on_impl_args: Mapping[str, Warning] | None class HookimplOpts(TypedDict): @@ -91,8 +97,8 @@ class HookspecMarker: firstresult: bool = False, historic: bool = False, warn_on_impl: Warning | None = None, - ) -> _F: - ... + warn_on_impl_args: Mapping[str, Warning] | None = None, + ) -> _F: ... @overload # noqa: F811 def __call__( # noqa: F811 @@ -101,8 +107,8 @@ class HookspecMarker: firstresult: bool = ..., historic: bool = ..., warn_on_impl: Warning | None = ..., - ) -> Callable[[_F], _F]: - ... + warn_on_impl_args: Mapping[str, Warning] | None = ..., + ) -> Callable[[_F], _F]: ... def __call__( # noqa: F811 self, @@ -110,6 +116,7 @@ class HookspecMarker: firstresult: bool = False, historic: bool = False, warn_on_impl: Warning | None = None, + warn_on_impl_args: Mapping[str, Warning] | None = None, ) -> _F | Callable[[_F], _F]: """If passed a function, directly sets attributes on the function which will make it discoverable to :meth:`PluginManager.add_hookspecs`. @@ -129,6 +136,13 @@ class HookspecMarker: :param warn_on_impl: If given, every implementation of this hook will trigger the given warning. See :ref:`warn_on_impl`. + + :param warn_on_impl_args: + If given, every implementation of this hook which requests one of + the arguments in the dict will trigger the corresponding warning. + See :ref:`warn_on_impl`. + + .. versionadded:: 1.5 """ def setattr_hookspec_opts(func: _F) -> _F: @@ -138,6 +152,7 @@ class HookspecMarker: "firstresult": firstresult, "historic": historic, "warn_on_impl": warn_on_impl, + "warn_on_impl_args": warn_on_impl_args, } setattr(func, self.project_name + "_spec", opts) return func @@ -172,8 +187,7 @@ class HookimplMarker: trylast: bool = ..., specname: str | None = ..., wrapper: bool = ..., - ) -> _F: - ... + ) -> _F: ... @overload # noqa: F811 def __call__( # noqa: F811 @@ -185,8 +199,7 @@ class HookimplMarker: trylast: bool = ..., specname: str | None = ..., wrapper: bool = ..., - ) -> Callable[[_F], _F]: - ... + ) -> Callable[[_F], _F]: ... def __call__( # noqa: F811 self, @@ -356,8 +369,7 @@ class HookRelay: if TYPE_CHECKING: - def __getattr__(self, name: str) -> HookCaller: - ... + def __getattr__(self, name: str) -> HookCaller: ... # Historical name (pluggy<=1.2), kept for backward compatibility. @@ -690,6 +702,7 @@ class HookSpec: "kwargnames", "opts", "warn_on_impl", + "warn_on_impl_args", ) def __init__(self, namespace: _Namespace, name: str, opts: HookspecOpts) -> None: @@ -699,3 +712,4 @@ class HookSpec: self.argnames, self.kwargnames = varnames(self.function) self.opts = opts self.warn_on_impl = opts.get("warn_on_impl") + self.warn_on_impl_args = opts.get("warn_on_impl_args") diff --git a/contrib/python/pluggy/py3/pluggy/_manager.py b/contrib/python/pluggy/py3/pluggy/_manager.py index ce1e107a60..9998dd815b 100644 --- a/contrib/python/pluggy/py3/pluggy/_manager.py +++ b/contrib/python/pluggy/py3/pluggy/_manager.py @@ -2,7 +2,6 @@ from __future__ import annotations import inspect import types -import warnings from typing import Any from typing import Callable from typing import cast @@ -11,6 +10,7 @@ from typing import Iterable from typing import Mapping from typing import Sequence from typing import TYPE_CHECKING +import warnings from . import _tracing from ._callers import _multicall @@ -26,6 +26,7 @@ from ._hooks import HookspecOpts from ._hooks import normalize_hookimpl_opts from ._result import Result + if TYPE_CHECKING: # importtlib.metadata import is slow, defer it. import importlib.metadata @@ -291,7 +292,7 @@ class PluginManager: def get_plugins(self) -> set[Any]: """Return a set of all registered plugin objects.""" - return set(self._name2plugin.values()) + return {x for x in self._name2plugin.values() if x is not None} def is_registered(self, plugin: _Plugin) -> bool: """Return whether the plugin is already registered.""" @@ -352,6 +353,12 @@ class PluginManager: ), ) + if hook.spec.warn_on_impl_args: + for hookimpl_argname in hookimpl.argnames: + argname_warning = hook.spec.warn_on_impl_args.get(hookimpl_argname) + if argname_warning is not None: + _warn_for_function(argname_warning, hookimpl.function) + if ( hookimpl.wrapper or hookimpl.hookwrapper ) and not inspect.isgeneratorfunction(hookimpl.function): diff --git a/contrib/python/pluggy/py3/pluggy/_result.py b/contrib/python/pluggy/py3/pluggy/_result.py index aa21fa1380..f9a081c4f6 100644 --- a/contrib/python/pluggy/py3/pluggy/_result.py +++ b/contrib/python/pluggy/py3/pluggy/_result.py @@ -1,6 +1,7 @@ """ Hook wrapper "result" utilities. """ + from __future__ import annotations from types import TracebackType diff --git a/contrib/python/pluggy/py3/pluggy/_tracing.py b/contrib/python/pluggy/py3/pluggy/_tracing.py index de1e13a7d3..cd238ad7e5 100644 --- a/contrib/python/pluggy/py3/pluggy/_tracing.py +++ b/contrib/python/pluggy/py3/pluggy/_tracing.py @@ -1,6 +1,7 @@ """ Tracing utils """ + from __future__ import annotations from typing import Any diff --git a/contrib/python/pluggy/py3/pluggy/_version.py b/contrib/python/pluggy/py3/pluggy/_version.py index ee6c4d7d05..c565007eec 100644 --- a/contrib/python/pluggy/py3/pluggy/_version.py +++ b/contrib/python/pluggy/py3/pluggy/_version.py @@ -12,5 +12,5 @@ __version__: str __version_tuple__: VERSION_TUPLE version_tuple: VERSION_TUPLE -__version__ = version = '1.4.0' -__version_tuple__ = version_tuple = (1, 4, 0) +__version__ = version = '1.5.0' +__version_tuple__ = version_tuple = (1, 5, 0) diff --git a/contrib/python/pluggy/py3/ya.make b/contrib/python/pluggy/py3/ya.make index 8dc442cdd1..ac57e7a2b7 100644 --- a/contrib/python/pluggy/py3/ya.make +++ b/contrib/python/pluggy/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(1.4.0) +VERSION(1.5.0) LICENSE(MIT) |