From e3e7287a86c02482656511c66831ed90622f8702 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:38:57 +0200 Subject: [PATCH] Remove obsolete typeguard checks --- marshmallow_dataclass/union_field.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/marshmallow_dataclass/union_field.py b/marshmallow_dataclass/union_field.py index ffe998d..87af18a 100644 --- a/marshmallow_dataclass/union_field.py +++ b/marshmallow_dataclass/union_field.py @@ -3,25 +3,12 @@ from typing import List, Tuple, Any, Optional import typeguard +from typeguard import TypeCheckError from marshmallow import fields, Schema, ValidationError -try: - from typeguard import TypeCheckError # type: ignore[attr-defined] -except ImportError: - # typeguard < 3 - TypeCheckError = TypeError # type: ignore[misc, assignment] -if "argname" not in inspect.signature(typeguard.check_type).parameters: - - def _check_type(value, expected_type, argname: str): - return typeguard.check_type(value=value, expected_type=expected_type) - -else: - # typeguard < 3.0.0rc2 - def _check_type(value, expected_type, argname: str): - return typeguard.check_type( # type: ignore[call-overload] - value=value, expected_type=expected_type, argname=argname - ) +def _check_type(value, expected_type, argname: str): + return typeguard.check_type(value=value, expected_type=expected_type) class Union(fields.Field):