[
https://issues.apache.org/jira/browse/AVRO-2921?focusedWorklogId=752025&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-752025
]
ASF GitHub Bot logged work on AVRO-2921:
----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Apr/22 03:42
Start Date: 03/Apr/22 03:42
Worklog Time Spent: 10m
Work Description: kojiromike commented on a change in pull request #1632:
URL: https://github.com/apache/avro/pull/1632#discussion_r841155379
##########
File path: lang/py/avro/__main__.py
##########
@@ -155,15 +154,20 @@ def convert(value: str, field: avro.schema.Field) ->
Union[int, float, str, byte
return value.lower() in ("1", "t", "true")
if type_ == "null":
return None
- if type_ == "union":
- return convert_union(value, field)
raise avro.errors.UsageError("No valid conversion type")
+def convert(value: str, field: avro.schema.Field) -> Union[int, float, str,
bytes, bool, None]:
+ type_ = field.type.type
+ return convert_union(value, field) if type_ == "union" else _cast(type_,
value)
+
+
def convert_union(value: str, field: avro.schema.Field) -> Union[int, float,
str, bytes, bool, None]:
- for name in (s.name for s in field.type.schemas):
Review comment:
I don't understand how this could have worked as written.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 752025)
Time Spent: 20m (was: 10m)
> Add Widespread Type Hinting in Python Implementation
> ----------------------------------------------------
>
> Key: AVRO-2921
> URL: https://issues.apache.org/jira/browse/AVRO-2921
> Project: Apache Avro
> Issue Type: Task
> Components: python
> Reporter: Michael A. Smith
> Assignee: Michael A. Smith
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Now that we only support Python 3.5 and above we can start adding type hints
> to the python implementation. This will improve quality, reveal long hidden
> bugs and API inconsistencies, and make future changes confident and easier.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)