zero323 commented on a change in pull request #35289:
URL: https://github.com/apache/spark/pull/35289#discussion_r790272894
##########
File path: python/pyspark/ml/param/__init__.py
##########
@@ -492,7 +493,7 @@ def _dummy() -> "Params":
dummy.uid = "undefined"
return dummy
- def _set(self, **kwargs: Any) -> "Params":
+ def _set(self: P, **kwargs: Any) -> P:
Review comment:
This is allow us to hint specific subclass of `Params`, that depends on
the input.
##########
File path: python/pyspark/ml/param/__init__.py
##########
@@ -529,7 +530,7 @@ def _setDefault(self, **kwargs: Any) -> "Params":
self._defaultParamMap[p] = value
return self
- def _copyValues(self, to: "Params", extra: Optional["ParamMap"] = None) ->
"Params":
+ def _copyValues(self, to: P, extra: Optional["ParamMap"] = None) -> P:
Review comment:
Ditto.
##########
File path: python/pyspark/ml/param/__init__.py
##########
@@ -513,7 +514,7 @@ def clear(self, param: Param) -> None:
if self.isSet(param):
del self._paramMap[param]
- def _setDefault(self, **kwargs: Any) -> "Params":
+ def _setDefault(self: P, **kwargs: Any) -> P:
Review comment:
Ditto.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]