[
https://issues.apache.org/jira/browse/BEAM-8280?focusedWorklogId=381170&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-381170
]
ASF GitHub Bot logged work on BEAM-8280:
----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Feb/20 19:55
Start Date: 03/Feb/20 19:55
Worklog Time Spent: 10m
Work Description: chadrik commented on pull request #10735:
[BEAM-8280][BEAM-8629] Make IOTypeHints immutable
URL: https://github.com/apache/beam/pull/10735#discussion_r374308055
##########
File path: sdks/python/apache_beam/typehints/decorators.py
##########
@@ -217,7 +220,10 @@ def get_signature(func):
return signature
-class IOTypeHints(object):
+class IOTypeHints(NamedTuple('IOTypeHints', [
+ ('input_types', Optional[Tuple[Tuple[Any, ...], Dict[str, Any]]]),
+ ('output_types', Optional[Tuple[Tuple[Any, ...], Dict[str, Any]]]),
+ ('origin', List[str])])):
Review comment:
I assumed that mypy would need the intermediate class _or_ would want that
class's name to match the name provided to `NamedTuple()`. For example, both
of these are invalid:
```python
class Foo(Generic[TypeVar('T')]): # TypeVar needs to be defined above
pass
T = TypeVar('T_with_suffix') # TypeVar name needs to match variable name
class Bar(Generic[T]):
pass
```
I just did my own isolated test of this and you're right, mypy has no issue
with it, so it appears there's nothing special about the name given to
`NamedTuple`, as far as mypy is concerned.
Thanks for taking the time to test that. I was trying to give some quick
feedback without getting too drawn in, but once I _did_ get drawn in, I should
have gone back and checked my original assumption!
----------------------------------------------------------------
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: 381170)
Time Spent: 3h 20m (was: 3h 10m)
> re-enable IOTypeHints.from_callable
> -----------------------------------
>
> Key: BEAM-8280
> URL: https://issues.apache.org/jira/browse/BEAM-8280
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: Udi Meiri
> Assignee: Udi Meiri
> Priority: Major
> Time Spent: 3h 20m
> Remaining Estimate: 0h
>
> See https://issues.apache.org/jira/browse/BEAM-8279
--
This message was sent by Atlassian Jira
(v8.3.4#803005)