Skip to content

Commit

Permalink
WIP: fix rebase artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Sep 3, 2024
1 parent ff368da commit fc17de2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
15 changes: 4 additions & 11 deletions src/pluggy/_callers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import warnings

from ._hooks import HookImpl
from ._result import _raise_wrapfail
from ._result import HookCallError
from ._result import Result
from ._warnings import PluggyTeardownRaisedWarning


TYPE_CHECKING = False
if TYPE_CHECKING:
Expand All @@ -21,25 +22,17 @@
from typing import Tuple
from typing import Union


# Need to distinguish between old- and new-style hook wrappers.
# Wrapping with a tuple is the fastest type-safe way I found to do it.
Teardown = Union[
Tuple[Generator[None, Result[object], None], HookImpl],
Generator[None, object, object],
]
Generator[None, object, object],
]
else:

def cast(t, v):
return v

from ._hooks import HookImpl
from ._result import HookCallError
from ._result import Result
from ._warnings import PluggyTeardownRaisedWarning




def _raise_wrapfail(
wrap_controller: (
Expand Down
4 changes: 2 additions & 2 deletions src/pluggy/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import warnings


_Plugin = object

TYPE_CHECKING = False
Expand Down Expand Up @@ -383,12 +384,11 @@ def __getattr__(self, name: str) -> HookCaller: ...

_CallHistory = List[Tuple[Mapping[str, object], Optional[Callable[[Any], None]]]]


# Historical name (pluggy<=1.2), kept for backward compatibility.
_HookRelay = HookRelay




class HookCaller:
"""A caller of all registered implementations of a hook specification."""

Expand Down
1 change: 1 addition & 0 deletions src/pluggy/_importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

from __future__ import annotations

import importlib.metadata
Expand Down
13 changes: 6 additions & 7 deletions src/pluggy/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@

TYPE_CHECKING = False
if TYPE_CHECKING:
from ._hooks import HookimplOpts
from ._hooks import HookspecOpts

from ._hooks import _HookImplFunction
from ._hooks import _Namespace

from importlib.metadata import Distribution
from typing import Any
from typing import Callable
from typing import Final
from typing import Iterable
from typing import Mapping
from typing import Sequence
from typing import TypeAlias
from importlib.metadata import Distribution

from ._hooks import _HookImplFunction
from ._hooks import _Namespace
from ._hooks import HookimplOpts
from ._hooks import HookspecOpts
from ._importlib_metadata import DistFacade

_BeforeTrace: TypeAlias = "Callable[[str, Sequence[HookImpl], Mapping[str, Any]], None]"
Expand Down
4 changes: 2 additions & 2 deletions src/pluggy/_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

from __future__ import annotations


TYPE_CHECKING = False
if TYPE_CHECKING:
from types import TracebackType
from typing import Callable
from typing import cast
from typing import final
from typing import Generic

from typing import Generic
from typing import Optional
from typing import Tuple
from typing import Type
Expand Down
7 changes: 6 additions & 1 deletion src/pluggy/_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@

from __future__ import annotations


TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Sequence, TypeAlias, Callable, Any, Tuple
from typing import Any
from typing import Callable
from typing import Sequence
from typing import Tuple
from typing import TypeAlias


_Writer: TypeAlias = "Callable[[str], object]"
Expand Down

0 comments on commit fc17de2

Please sign in to comment.