From d6223a1c2578dd4b583e6fcb78e3e1fd952d285d Mon Sep 17 00:00:00 2001 From: Nick Mills-Barrett Date: Sat, 9 Mar 2024 11:42:24 +0000 Subject: [PATCH] Fix remaining type issues with arguments dicts --- pyinfra/api/host.py | 2 +- pyinfra/api/operation.py | 2 +- pyinfra/api/operations.py | 9 ++++----- tests/words.txt | 3 +++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pyinfra/api/host.py b/pyinfra/api/host.py index 564534dbc..b8503c12d 100644 --- a/pyinfra/api/host.py +++ b/pyinfra/api/host.py @@ -10,13 +10,13 @@ Type, TypeVar, Union, - Unpack, cast, overload, ) from uuid import uuid4 import click +from typing_extensions import Unpack from pyinfra import logger from pyinfra.connectors.base import BaseConnector diff --git a/pyinfra/api/operation.py b/pyinfra/api/operation.py index 57f100310..0b53d51fc 100644 --- a/pyinfra/api/operation.py +++ b/pyinfra/api/operation.py @@ -214,7 +214,7 @@ def decorated_func(*args: P.args, **kwargs: P.kwargs) -> OperationMeta: if func.deprecated_for: # type: ignore[attr-defined] logger.warning( f"The {get_operation_name_from_func(func)} operation is " - + f"deprecated, please use: {func.deprecated_for}", # type: ignore[attr-defined] + + f"deprecated, please use: {func.deprecated_for}", # type: ignore[attr-defined] # noqa ) else: logger.warning(f"The {get_operation_name_from_func(func)} operation is deprecated") diff --git a/pyinfra/api/operations.py b/pyinfra/api/operations.py index e121d49a9..1e38eedb4 100644 --- a/pyinfra/api/operations.py +++ b/pyinfra/api/operations.py @@ -67,11 +67,10 @@ def _run_host_op(state: "State", host: "Host", op_hash: str) -> Optional[bool]: timeout = global_arguments.get("_timeout", 0) executor_kwarg_keys = CONNECTOR_ARGUMENT_KEYS - base_connector_arguments: ConnectorArguments = ( - cast( # https://github.com/python/mypy/issues/10371 - ConnectorArguments, - {key: global_arguments[key] for key in executor_kwarg_keys if key in global_arguments}, - ) + # See: https://github.com/python/mypy/issues/10371 + base_connector_arguments: ConnectorArguments = cast( + ConnectorArguments, + {key: global_arguments[key] for key in executor_kwarg_keys if key in global_arguments}, # type: ignore[literal-required] # noqa ) did_error = False diff --git a/tests/words.txt b/tests/words.txt index 8dd8a9b8c..25a0d9faf 100644 --- a/tests/words.txt +++ b/tests/words.txt @@ -127,6 +127,7 @@ e501 ed25519 endian entrypoint +envvar epel excuted exe @@ -343,6 +344,7 @@ status stdlib stringify stringio +strs su subclassed subclassing @@ -383,6 +385,7 @@ ufw uname unignored unmount +unresposivehost up up2 useradd