Skip to content

Commit

Permalink
Fix for Python 3.9-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
rnag committed Nov 22, 2024
1 parent ef4ad2e commit 6d0951b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions dataclass_wizard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@
#
# The `type` statement is introduced in Python 3.12
# Ref: https://docs.python.org/3.12/reference/simple_stmts.html#type
if PY312_OR_ABOVE:
type CatchAll = Mapping
else:
CatchAll = NewType('CatchAll', Mapping)
#
# TODO: Remove function declaration once we drop support
# for Python 3.9-3.11
def get_catch_all():
if PY312_OR_ABOVE:
type CatchAll = Mapping
return CatchAll
else:
return NewType('CatchAll', Mapping)


CatchAll = get_catch_all()


class Extras(PyTypedDict):
Expand Down

0 comments on commit 6d0951b

Please sign in to comment.