Skip to content

Commit

Permalink
Merge pull request #299 from jacebrowning/release-2.1.1
Browse files Browse the repository at this point in the history
Fix missing default value with containers
  • Loading branch information
jacebrowning authored May 4, 2023
2 parents 96dc593 + 9b9830a commit 4abe580
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 2.1.1 (2023-05-04)

- Fixed missing default value for `target_object` in container converters.

## 2.1 (2023-03-26)

- Added support for Python 3.11.
Expand Down
8 changes: 4 additions & 4 deletions datafiles/converters/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def of_type(cls, converter: type):
return type(name, bases, attributes)

@classmethod
def to_python_value(cls, deserialized_data, *, target_object):
def to_python_value(cls, deserialized_data, *, target_object=None):
if target_object is None or target_object is Missing:
value = []
else:
Expand Down Expand Up @@ -92,7 +92,7 @@ class Set(List):
"""Base converter for sets."""

@classmethod
def to_python_value(cls, deserialized_data, *, target_object):
def to_python_value(cls, deserialized_data, *, target_object=None):
if target_object is None or target_object is Missing:
value = set()
else:
Expand Down Expand Up @@ -137,7 +137,7 @@ def of_mapping(cls, key: type, value: type):
return type(name, bases, {})

@classmethod
def to_python_value(cls, deserialized_data, *, target_object):
def to_python_value(cls, deserialized_data, *, target_object=None):
if isinstance(deserialized_data, dict):
data = deserialized_data.copy()
else:
Expand Down Expand Up @@ -176,7 +176,7 @@ def of_mappings(cls, dataclass, converters: Dict[str, type]):
return type(name, bases, attributes)

@classmethod
def to_python_value(cls, deserialized_data, *, target_object):
def to_python_value(cls, deserialized_data, *, target_object=None):
if dataclasses.is_dataclass(deserialized_data):
data = dataclasses.asdict(deserialized_data)
elif isinstance(deserialized_data, dict):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]

name = "datafiles"
version = "2.1"
version = "2.1.1"
description = "File-based ORM for dataclasses."

license = "MIT"
Expand Down

0 comments on commit 4abe580

Please sign in to comment.