Browse Source

Intermediate changes

robot-piglet 10 months ago
parent
commit
878465276c

+ 16 - 1
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

+ 15 - 0
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

+ 13 - 15
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

+ 2 - 1
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

+ 25 - 11
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")

+ 9 - 2
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):

+ 1 - 0
contrib/python/pluggy/py3/pluggy/_result.py

@@ -1,6 +1,7 @@
 """
 Hook wrapper "result" utilities.
 """
+
 from __future__ import annotations
 
 from types import TracebackType

+ 1 - 0
contrib/python/pluggy/py3/pluggy/_tracing.py

@@ -1,6 +1,7 @@
 """
 Tracing utils
 """
+
 from __future__ import annotations
 
 from typing import Any

+ 2 - 2
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)

+ 1 - 1
contrib/python/pluggy/py3/ya.make

@@ -2,7 +2,7 @@
 
 PY3_LIBRARY()
 
-VERSION(1.4.0)
+VERSION(1.5.0)
 
 LICENSE(MIT)