From 57585c228818c474a8caa43cf0d6389060ebf80e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 22:33:39 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- src/typeguard/_decorators.py | 12 +++++------- src/typeguard/_functions.py | 8 +++----- src/typeguard/_suppression.py | 6 ++---- src/typeguard/_transformer.py | 6 ++---- src/typeguard/_union_transformer.py | 1 + tests/__init__.py | 6 ++---- tests/dummymodule.py | 7 +++---- 8 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3f0163b..9585da31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: args: [--fix, --show-fixes] - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black exclude: "^tests/mypy/negative.py" diff --git a/src/typeguard/_decorators.py b/src/typeguard/_decorators.py index 53f254f7..cf325335 100644 --- a/src/typeguard/_decorators.py +++ b/src/typeguard/_decorators.py @@ -133,13 +133,11 @@ def typechecked( typecheck_fail_callback: TypeCheckFailCallback | Unset = unset, collection_check_strategy: CollectionCheckStrategy | Unset = unset, debug_instrumentation: bool | Unset = unset, -) -> Callable[[T_CallableOrType], T_CallableOrType]: - ... +) -> Callable[[T_CallableOrType], T_CallableOrType]: ... @overload -def typechecked(target: T_CallableOrType) -> T_CallableOrType: - ... +def typechecked(target: T_CallableOrType) -> T_CallableOrType: ... def typechecked( @@ -215,9 +213,9 @@ def typechecked( return target # Find either the first Python wrapper or the actual function - wrapper_class: type[classmethod[Any, Any, Any]] | type[ - staticmethod[Any, Any] - ] | None = None + wrapper_class: ( + type[classmethod[Any, Any, Any]] | type[staticmethod[Any, Any]] | None + ) = None if isinstance(target, (classmethod, staticmethod)): wrapper_class = target.__class__ target = target.__func__ diff --git a/src/typeguard/_functions.py b/src/typeguard/_functions.py index db55e5a3..28497856 100644 --- a/src/typeguard/_functions.py +++ b/src/typeguard/_functions.py @@ -32,8 +32,7 @@ def check_type( forward_ref_policy: ForwardRefPolicy = ..., typecheck_fail_callback: TypeCheckFailCallback | None = ..., collection_check_strategy: CollectionCheckStrategy = ..., -) -> T: - ... +) -> T: ... @overload @@ -44,8 +43,7 @@ def check_type( forward_ref_policy: ForwardRefPolicy = ..., typecheck_fail_callback: TypeCheckFailCallback | None = ..., collection_check_strategy: CollectionCheckStrategy = ..., -) -> Any: - ... +) -> Any: ... def check_type( @@ -53,7 +51,7 @@ def check_type( expected_type: Any, *, forward_ref_policy: ForwardRefPolicy = TypeCheckConfiguration().forward_ref_policy, - typecheck_fail_callback: (TypeCheckFailCallback | None) = ( + typecheck_fail_callback: TypeCheckFailCallback | None = ( TypeCheckConfiguration().typecheck_fail_callback ), collection_check_strategy: CollectionCheckStrategy = ( diff --git a/src/typeguard/_suppression.py b/src/typeguard/_suppression.py index aca1b3eb..f6899a9f 100644 --- a/src/typeguard/_suppression.py +++ b/src/typeguard/_suppression.py @@ -20,13 +20,11 @@ @overload -def suppress_type_checks(func: Callable[P, T]) -> Callable[P, T]: - ... +def suppress_type_checks(func: Callable[P, T]) -> Callable[P, T]: ... @overload -def suppress_type_checks() -> ContextManager[None]: - ... +def suppress_type_checks() -> ContextManager[None]: ... def suppress_type_checks( diff --git a/src/typeguard/_transformer.py b/src/typeguard/_transformer.py index 11c4d04a..aeb15e30 100644 --- a/src/typeguard/_transformer.py +++ b/src/typeguard/_transformer.py @@ -589,12 +589,10 @@ def _get_import(self, module: str, name: str) -> Name: return memo.get_import(module, name) @overload - def _convert_annotation(self, annotation: None) -> None: - ... + def _convert_annotation(self, annotation: None) -> None: ... @overload - def _convert_annotation(self, annotation: expr) -> expr: - ... + def _convert_annotation(self, annotation: expr) -> expr: ... def _convert_annotation(self, annotation: expr | None) -> expr | None: if annotation is None: diff --git a/src/typeguard/_union_transformer.py b/src/typeguard/_union_transformer.py index fcd6349d..19617e6a 100644 --- a/src/typeguard/_union_transformer.py +++ b/src/typeguard/_union_transformer.py @@ -2,6 +2,7 @@ Transforms lazily evaluated PEP 604 unions into typing.Unions, for compatibility with Python versions older than 3.10. """ + from __future__ import annotations from ast import ( diff --git a/tests/__init__.py b/tests/__init__.py index 093aeaa8..827ced8d 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -47,13 +47,11 @@ def method(self, a: int) -> None: class StaticProtocol(Protocol): - def meth(self) -> None: - ... + def meth(self) -> None: ... @runtime_checkable class RuntimeProtocol(Protocol): member: int - def meth(self) -> None: - ... + def meth(self) -> None: ... diff --git a/tests/dummymodule.py b/tests/dummymodule.py index 4d68f21f..e4bf97bc 100644 --- a/tests/dummymodule.py +++ b/tests/dummymodule.py @@ -1,4 +1,5 @@ """Module docstring.""" + import sys from contextlib import contextmanager from typing import ( @@ -132,13 +133,11 @@ def dummy_context_manager() -> Generator[int, None, None]: @overload -def overloaded_func(a: int) -> int: - ... +def overloaded_func(a: int) -> int: ... @overload -def overloaded_func(a: str) -> str: - ... +def overloaded_func(a: str) -> str: ... @typechecked