Skip to content

Commit

Permalink
remove mypy_extensions dep (nornir-automation#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemith authored Oct 3, 2023
1 parent 0424c07 commit 33eb0d3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 186 deletions.
14 changes: 9 additions & 5 deletions nornir/core/inventory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Expand All @@ -11,6 +10,7 @@
ItemsView,
Iterator,
TypeVar,
Protocol,
)

from nornir.core.configuration import Config
Expand All @@ -20,8 +20,6 @@
)
from nornir.core.exceptions import ConnectionAlreadyOpen, ConnectionNotOpen

from mypy_extensions import Arg, KwArg


HostOrGroup = TypeVar("HostOrGroup", "Host", "Group")

Expand Down Expand Up @@ -584,8 +582,14 @@ class Groups(Dict[str, Group]):
pass


TransformFunction = Callable[[Arg(Host), KwArg(Any)], None]
FilterObj = Callable[[Arg(Host), KwArg(Any)], bool]
class TransformFunction(Protocol):
def __call__(self, host: Host, **kwargs: Any) -> None:
...


class FilterObj(Protocol):
def __call__(self, host: Host, **kwargs: Any) -> bool:
...


class Inventory(object):
Expand Down
Loading

0 comments on commit 33eb0d3

Please sign in to comment.