Skip to content

Commit ddcb1ab

Browse files
authored
v0.35.1-bugfix (#177)
* roll back `key_case='AUTO'` in docs * Roll back `key_case='AUTO'` in docs, as serialization for `v1` Opt-In might not default to `camelCase` in a future minor release * fix `mypy` error * fix `mypy` error * fix GH actions
1 parent a6d7f9a commit ddcb1ab

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

.github/workflows/dev.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@ name: CI
44

55
# Controls when the action will run.
66
on:
7+
push:
8+
branches: [ main ]
79
# Triggers the workflow on pull request events but only for the master branch
810
pull_request:
9-
branches: [ master, main ]
11+
branches: [ main ]
1012

1113
# Allows you to run this workflow manually from the Actions tab
1214
workflow_dispatch:
1315

16+
concurrency:
17+
group: ci-${{ github.ref }}
18+
cancel-in-progress: true
19+
1420
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1521
jobs:
1622
# This workflow contains a single job called "build"
1723
test:
1824
# The type of runner that the job will run on
25+
timeout-minutes: 30
1926
strategy:
2027
matrix:
21-
python-versions: [3.9, '3.10', '3.11', '3.12', '3.13']
22-
os: [ubuntu-20.04]
28+
python-versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
29+
os: [ubuntu-latest]
2330
# Uncomment if I need to run it on other environments too (currently
2431
# there's not a huge need)
2532
# os: [ubuntu-20.04, windows-latest, macos-latest]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ for complex and *nested dataclass* models!
3636
>>> from dataclass_wizard import JSONWizard
3737
...
3838
>>> @dataclass
39-
... class MyClass(JSONWizard, key_case='AUTO'):
39+
... class MyClass(JSONWizard):
4040
... my_str: str | None
4141
... is_active_tuple: tuple[bool, ...]
4242
... list_of_int: list[int] = field(default_factory=list)

dataclass_wizard/models.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import json
22
from dataclasses import MISSING, Field
33
from datetime import date, datetime, time
44
from typing import (Collection, Callable,
5-
Generic, Mapping)
5+
Generic, Mapping, TypeAlias)
66
from typing import TypedDict, overload, Any, NotRequired
77

88
from .bases import META
@@ -13,10 +13,10 @@ from .utils.object_path import PathPart, PathType
1313

1414

1515
# Define a simple type (alias) for the `CatchAll` field
16-
CatchAll = Mapping | None
16+
CatchAll: TypeAlias = Mapping | None
1717

1818
# Type for a string or a collection of strings.
19-
_STR_COLLECTION = str | Collection[str]
19+
_STR_COLLECTION: TypeAlias = str | Collection[str]
2020

2121

2222
class Extras(TypedDict):

dataclass_wizard/v1/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ def load_to_pattern(self, tp: TypeInfo, extras: Extras):
270270
fn_gen = extras['fn_gen']
271271
_locals = extras['locals']
272272

273-
assert 'cls' not in _locals
274-
275273
is_datetime \
276274
= is_date \
277275
= is_time \

dataclass_wizard/v1/models.pyi

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import MISSING, Field as _Field, dataclass
22
from datetime import datetime, date, time, tzinfo
33
from typing import (Collection, Callable,
4-
Mapping, Generic, Sequence)
4+
Generic, Sequence, TypeAlias)
55
from typing import TypedDict, overload, Any, NotRequired, Self
66

77
from ..bases import META
@@ -11,11 +11,8 @@ from ..utils.function_builder import FunctionBuilder
1111
from ..utils.object_path import PathType
1212

1313

14-
# Define a simple type (alias) for the `CatchAll` field
15-
CatchAll = Mapping | None
16-
1714
# Type for a string or a collection of strings.
18-
type _STR_COLLECTION = str | Collection[str]
15+
_STR_COLLECTION: TypeAlias = str | Collection[str]
1916

2017

2118
@dataclass(order=True)

dataclass_wizard/wizard_mixins.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ __all__ = ['JSONListWizard',
55

66
import json
77
from os import PathLike
8-
from typing import AnyStr, TextIO, BinaryIO
8+
from typing import AnyStr, TextIO, BinaryIO, Union, TypeAlias
99

1010
from .abstractions import W
1111
from .enums import LetterCase
@@ -17,7 +17,8 @@ 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+
# A type that can be string, bytes, or `PathLike`
21+
FileType: TypeAlias = Union[str, bytes, PathLike]
2122

2223

2324
class JSONListWizard(JSONSerializable, str=False):

docs/common_use_cases/v1_alias.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ for bulk aliasing:
163163
print(t.to_dict())
164164
# > {'my_str': 'test', 'myDumpedBool': True, 'MyInt': 123, 'DumpedInt': 321}
165165
166-
AliasPath
167-
---------
166+
Alias Paths
167+
-----------
168168

169169
Maps one or more nested JSON paths to a dataclass field. See documentation on :func:`AliasPath` for more details.
170170

0 commit comments

Comments
 (0)