You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/11/09 07:42:57 UTC

[GitHub] [beam] ronshapiro opened a new issue, #24052: [Bug]: collections.abc.Iterable[T] is rejected as a typehint

ronshapiro opened a new issue, #24052:
URL: https://github.com/apache/beam/issues/24052

   ### What happened?
   
   Trying to use typing.Iterable[T] in Beam code works fine, but collections.abc.Iterable[T] does not. 
   
   I imagine that the special casing of the typing module should be extended to collections.abc as well.
   
   
   ```python
   print(typehints.is_consistent_with(Iterable[str], Iterable[Any]))
   > True
   print(typehints.is_consistent_with(collections.abc.Iterable[str], Iterable[Any]))
   > False
   print(typehints.is_consistent_with(collections.abc.Iterable[str], collections.abc.Iterable[Any]))
   > TypeError: issubclass() argument 2 cannot be a parameterized generic
   ```
   
   ### Issue Priority
   
   Priority: 2
   
   ### Issue Component
   
   Component: sdk-py-core


-- 
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: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] davidcavazos commented on issue #24052: [Improvement]: accept collections.abc.Iterable[T] as a type hint

Posted by "davidcavazos (via GitHub)" <gi...@apache.org>.
davidcavazos commented on issue #24052:
URL: https://github.com/apache/beam/issues/24052#issuecomment-1426449568

   As part of [PEP-585](https://peps.python.org/pep-0585), Python is now standardizing all type hinting annotations into the `collections` library rather than the `typing` library, starting from Python 3.9. [Here's a list of all the standard generic types](https://peps.python.org/pep-0585/#implementation).
   
   **Workaround:**
   
   ```py
   from __future__ import annotations
   ```


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] kennknowles commented on issue #24052: [Bug]: collections.abc.Iterable[T] is rejected as a typehint

Posted by GitBox <gi...@apache.org>.
kennknowles commented on issue #24052:
URL: https://github.com/apache/beam/issues/24052#issuecomment-1314365561

   CC @tvalentyn @robertwb 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org