Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-morel committed May 4, 2024
1 parent 3053e26 commit 3e559cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pyoload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ def cast(val, type):
for x in type:
try:
return Cast.cast(val, x)
except:
except Exception:
pass
else:
raise CastingError()
return type(val) if not isinstance(val, type) else val

def __init__(self, type):
self.type = type

def __call__(self, val):

try:
return Cast.cast(self.type, val)
except Exception as e:
Expand All @@ -93,7 +93,7 @@ def typeMatch(val, spec):
return isinstance(val, tuple)
if isinstance(spec, Values):
return spec(val)
elif isinstance(spec, TypeChecker):
elif isinstance(spec, Validator):
return spec(val)
elif isinstance(spec, GenericAlias):
if not isinstance(val, spec.__origin__):
Expand Down

0 comments on commit 3e559cf

Please sign in to comment.