Skip to content

Commit a1a3977

Browse files
committed
Make typing hints work with Python 3.9 to 3.11
Change typing hints to allow static type checkers to work if client code uses Python 3.9 to Python 3.11. Background: > The type statement is new in Python 3.12. For > backwards compatibility, type aliases can also > be created through simple assignment: Link: https://docs.python.org/3/library/typing.html
1 parent a6d7f9a commit a1a3977

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

dataclass_wizard/environ/lookups.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ from ..decorators import cached_class_property
55
from ..type_def import StrCollection, EnvFileType
66

77

8-
type _MISSING_TYPE = type(MISSING)
9-
type STR_OR_MISSING = str | _MISSING_TYPE
10-
type STR_OR_NONE = str | None
8+
_MISSING_TYPE = type(MISSING)
9+
STR_OR_MISSING = str | _MISSING_TYPE
10+
STR_OR_NONE = str | None
1111

1212
# Type of `os.environ` or `DotEnv` dict
1313
Environ = dict[str, STR_OR_NONE]

dataclass_wizard/utils/object_path.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from dataclasses import MISSING
22
from typing import Any, Sequence
33

4-
type PathPart = str | int | float | bool
5-
type PathType = Sequence[PathPart]
4+
PathPart = str | int | float | bool
5+
PathType = Sequence[PathPart]
66

77

88
def safe_get(data: dict | list,

dataclass_wizard/v1/models.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from ..utils.object_path import PathType
1515
CatchAll = Mapping | None
1616

1717
# Type for a string or a collection of strings.
18-
type _STR_COLLECTION = str | Collection[str]
18+
_STR_COLLECTION = str | Collection[str]
1919

2020

2121
@dataclass(order=True)

dataclass_wizard/wizard_mixins.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ from .type_def import (T, ListOfJSONObject,
1717

1818
# A type that can be string or `path.Path`
1919
# https://stackoverflow.com/a/78070015/10237506
20-
type FileType = str | bytes | PathLike
20+
FileType = str | bytes | PathLike
2121

2222

2323
class JSONListWizard(JSONSerializable, str=False):

0 commit comments

Comments
 (0)