[
https://issues.apache.org/jira/browse/BEAM-8490?focusedWorklogId=352353&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-352353
]
ASF GitHub Bot logged work on BEAM-8490:
----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Dec/19 00:47
Start Date: 03/Dec/19 00:47
Worklog Time Spent: 10m
Work Description: kennknowles commented on pull request #9894:
[BEAM-8490] Fix instance_to_type for empty containers
URL: https://github.com/apache/beam/pull/9894#discussion_r352934686
##########
File path: sdks/python/apache_beam/typehints/trivial_inference.py
##########
@@ -65,18 +65,27 @@ def instance_to_type(o):
elif t == tuple:
return typehints.Tuple[[instance_to_type(item) for item in o]]
elif t == list:
- return typehints.List[
- typehints.Union[[instance_to_type(item) for item in o]]
- ]
+ if len(o):
Review comment:
nit: `len(o) > 0` is clearer IMO (easier to read quickly). Here and below.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 352353)
Time Spent: 40m (was: 0.5h)
> Python typehints: properly resolve empty dict type
> --------------------------------------------------
>
> Key: BEAM-8490
> URL: https://issues.apache.org/jira/browse/BEAM-8490
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: Udi Meiri
> Assignee: Udi Meiri
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Currently:
> {code}
> trivial_inference.instance_to_type({})
> {code}
> returns
> {code}
> Dict[Union[], Union[]]
> {code}
> instead of
> {code}
> Dict[Any,Any]
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)