Skip to content

Commit

Permalink
Remove obsolete typeguard checks
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Jul 1, 2024
1 parent 4edbfb4 commit e3e7287
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions marshmallow_dataclass/union_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e3e7287

Please # to comment.