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 deprecated mypy_extensions and typing_extensions deps #863

Closed
wants to merge 1 commit into from
Closed
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
28 changes: 14 additions & 14 deletions nornir/core/inventory.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
from typing import (
Any,
Callable,
Dict,
ItemsView,
Iterator,
KeysView,
List,
Optional,
Protocol,
Set,
TypeVar,
Union,
KeysView,
ValuesView,
ItemsView,
Iterator,
TypeVar,
)

from nornir.core.configuration import Config
from nornir.core.plugins.connections import (
ConnectionPlugin,
ConnectionPluginRegister,
)
from nornir.core.exceptions import ConnectionAlreadyOpen, ConnectionNotOpen

from mypy_extensions import Arg, KwArg

from nornir.core.plugins.connections import ConnectionPlugin, ConnectionPluginRegister

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

Expand Down Expand Up @@ -584,8 +578,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
5 changes: 1 addition & 4 deletions nornir/core/plugins/connections.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from typing import Any, Dict, Type, Optional
from typing import Any, Dict, Optional, Protocol, Type

from nornir.core.configuration import Config
from nornir.core.plugins.register import PluginRegister

from typing_extensions import Protocol


CONNECTIONS_PLUGIN_PATH = "nornir.plugins.connections"


Expand Down
5 changes: 1 addition & 4 deletions nornir/core/plugins/inventory.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from typing import Any, Type
from typing import Any, Protocol, Type

from nornir.core.inventory import Inventory, TransformFunction
from nornir.core.plugins.register import PluginRegister

from typing_extensions import Protocol


INVENTORY_PLUGIN_PATH = "nornir.plugins.inventory"
TRANSFORM_FUNCTION_PLUGIN_PATH = "nornir.plugins.transform_function"

Expand Down
7 changes: 2 additions & 5 deletions nornir/core/plugins/runners.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from typing import Any, List, Type
from typing import Any, List, Protocol, Type

from nornir.core.task import AggregatedResult, Task
from nornir.core.inventory import Host
from nornir.core.plugins.register import PluginRegister

from typing_extensions import Protocol

from nornir.core.task import AggregatedResult, Task

RUNNERS_PLUGIN_PATH = "nornir.plugins.runners"

Expand Down
4 changes: 1 addition & 3 deletions nornir/core/processor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from typing import List
from typing import List, Protocol

from nornir.core.inventory import Host
from nornir.core.task import AggregatedResult, MultiResult, Task

from typing_extensions import Protocol


class Processor(Protocol):
"""
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ pylama = "*"
requests-mock = "*"
black = "^23.7.0"
mypy = "^1.5.1"
mypy_extensions = "^1.0.0"
types-Jinja2 = "^2.11.9"
types-pkg-resources = "^0.1.3"
typing_extensions = "^4.7.1"
nornir-jinja2 = "0.2.0"
nornir-utils = "0.2.0"
nornir-napalm = "0.4.0"
Expand Down