Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0be833f
Fixes for Python 3.9
Gobot1234 Aug 15, 2020
4910af3
Add 3.9 to the test suite
Gobot1234 Aug 15, 2020
a93bf39
Respond to review
Gobot1234 Aug 17, 2020
274a533
Fix version
Gobot1234 Aug 21, 2020
0d6ced5
Implement Message.__bool__ for #130
Gobot1234 Aug 24, 2020
7746b91
Add a test for it
Gobot1234 Aug 24, 2020
962ef87
Potential fix?
Gobot1234 Aug 29, 2020
9856227
Install wheel
Gobot1234 Aug 29, 2020
53a7df0
Merge branch 'master' into master
Gobot1234 Sep 2, 2020
9da923d
Blacken
Gobot1234 Sep 2, 2020
01f479d
Refresh
Gobot1234 Sep 11, 2020
acc4132
Fix refreshed
Gobot1234 Sep 11, 2020
182b41f
Try and make bpython dependant on platform
Gobot1234 Sep 13, 2020
487cda4
Merge remote-tracking branch 'origin/fixes' into fixes
Gobot1234 Sep 13, 2020
913475b
Try and make bpython dependant on platform
Gobot1234 Sep 13, 2020
f2f0fa8
Merge remote-tracking branch 'origin/master' into fixes
Gobot1234 Sep 13, 2020
bdb8b19
Regen lock
Gobot1234 Sep 13, 2020
656b3fc
Flip operator
Gobot1234 Sep 13, 2020
393ff29
Try moving wheel install?
Gobot1234 Sep 13, 2020
7f1539a
Merge branch 'master' into fixes
Gobot1234 Sep 21, 2020
a475b61
See if 3.9 is better now
Gobot1234 Oct 15, 2020
80f7163
Merge branch 'master' into fixes
Gobot1234 Oct 15, 2020
318525a
Bump lock
Gobot1234 Oct 15, 2020
15e67b4
Use more generic version
Gobot1234 Oct 15, 2020
5858f04
Skip 3.9 on windows
Gobot1234 Oct 15, 2020
471776d
IDK what the key for this should be
Gobot1234 Oct 15, 2020
7179c32
IDK what the key for this should be
Gobot1234 Oct 15, 2020
f1c76e2
IDK what the key for this should be
Gobot1234 Oct 15, 2020
da6bca3
Wheels suck
Gobot1234 Oct 15, 2020
9bf337f
Final changes
Gobot1234 Oct 15, 2020
d06c7b7
Revert lock
Gobot1234 Oct 18, 2020
d8d2563
Update __init__.py
Gobot1234 Oct 30, 2020
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

Expand Down
8 changes: 4 additions & 4 deletions src/betterproto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,9 @@ def to_dict(
"""
output: Dict[str, Any] = {}
field_types = self._type_hints()
defaults = self._betterproto.default_gen
for field_name, meta in self._betterproto.meta_by_field_name.items():
field_type = field_types[field_name]
field_is_repeated = type(field_type) is type(typing.List)
field_is_repeated = defaults[field_name] is list
value = getattr(self, field_name)
cased_name = casing(field_name).rstrip("_") # type: ignore
if meta.proto_type == TYPE_MESSAGE:
Expand Down Expand Up @@ -994,7 +994,7 @@ def to_dict(
output[cased_name] = b64encode(value).decode("utf8")
elif meta.proto_type == TYPE_ENUM:
if field_is_repeated:
enum_class: Type[Enum] = field_type.__args__[0]
enum_class: Type[Enum] = field_types[field_name].__args__[0]
if isinstance(value, typing.Iterable) and not isinstance(
value, str
):
Expand All @@ -1003,7 +1003,7 @@ def to_dict(
# transparently upgrade single value to repeated
output[cased_name] = [enum_class(value).name]
else:
enum_class: Type[Enum] = field_type # noqa
enum_class: Type[Enum] = field_types[field_name] # noqa
output[cased_name] = enum_class(value).name
else:
output[cased_name] = value
Expand Down