shunping commented on code in PR #34310:
URL: https://github.com/apache/beam/pull/34310#discussion_r1998950047
##########
sdks/python/apache_beam/ml/anomaly/specifiable.py:
##########
@@ -250,13 +250,35 @@ def _get_init_kwargs(inst, init_method, *args, **kwargs):
return params
+@overload
def specifiable(
- my_cls=None,
+ my_cls: None = None,
/,
*,
- spec_type=None,
- on_demand_init=True,
- just_in_time_init=True):
+ spec_type: Optional[str] = None,
+ on_demand_init: bool = True,
+ just_in_time_init: bool = True) -> Callable[[T], T]:
+ ...
+
+
+@overload
Review Comment:
That's for better type hinting, so that static checker will be able to pick
up whether the decorator is using the form
```
@specifiable
class A
```
or
```
@specifiable(spec_type=...)
class B
```
--
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]