Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mypy_extensions dep #870

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading