udim commented on a change in pull request #13493:
URL: https://github.com/apache/beam/pull/13493#discussion_r538762100
##########
File path: sdks/python/apache_beam/typehints/sharded_key_type.py
##########
@@ -25,8 +25,12 @@
from apache_beam.typehints.typehints import match_type_variables
from apache_beam.utils.sharded_key import ShardedKey
+from future.utils import with_metaclass
-class ShardedKeyTypeConstraint(typehints.TypeConstraint):
+
+class ShardedKeyTypeConstraint(with_metaclass(typehints.GetitemConstructor,
Review comment:
This works:
```py
def __class_getitem__(cls, py_type):
return cls(py_type)
```
The alternative is to use a wrapper object instance such as `IterableHint`
that has `__getitem__`, and then define `Iterable = IterableHint()`.
----------------------------------------------------------------
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]