Skip to content

Make typing hints work with Python 3.9 to 3.11 #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dataclass_wizard/environ/lookups.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ from ..decorators import cached_class_property
from ..type_def import StrCollection, EnvFileType


type _MISSING_TYPE = type(MISSING)
type STR_OR_MISSING = str | _MISSING_TYPE
type STR_OR_NONE = str | None
_MISSING_TYPE = type(MISSING)
STR_OR_MISSING = str | _MISSING_TYPE
STR_OR_NONE = str | None

# Type of `os.environ` or `DotEnv` dict
Environ = dict[str, STR_OR_NONE]
Expand Down
4 changes: 2 additions & 2 deletions dataclass_wizard/utils/object_path.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from dataclasses import MISSING
from typing import Any, Sequence

type PathPart = str | int | float | bool
type PathType = Sequence[PathPart]
PathPart = str | int | float | bool
PathType = Sequence[PathPart]


def safe_get(data: dict | list,
Expand Down
2 changes: 1 addition & 1 deletion dataclass_wizard/v1/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from ..utils.object_path import PathType
CatchAll = Mapping | None

# Type for a string or a collection of strings.
type _STR_COLLECTION = str | Collection[str]
_STR_COLLECTION = str | Collection[str]


@dataclass(order=True)
Expand Down
2 changes: 1 addition & 1 deletion dataclass_wizard/wizard_mixins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from .type_def import (T, ListOfJSONObject,

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


class JSONListWizard(JSONSerializable, str=False):
Expand Down