You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/07 16:01:23 UTC
[GitHub] [spark] zero323 commented on a change in pull request #29969: [SPARK-33086][PYTHON] Add static annotations for pyspark.resource
zero323 commented on a change in pull request #29969:
URL: https://github.com/apache/spark/pull/29969#discussion_r501130036
##########
File path: python/pyspark/resource/profile.pyi
##########
@@ -22,30 +22,39 @@ from pyspark.resource.requests import ( # noqa: F401
TaskResourceRequest as TaskResourceRequest,
TaskResourceRequests as TaskResourceRequests,
)
-from typing import Any, Optional
+from typing import overload, Dict, Optional, Union
+from py4j.java_gateway import JavaObject # type: ignore
class ResourceProfile:
+ @overload
def __init__(
self,
- _java_resource_profile: Optional[Any] = ...,
- _exec_req: Any = ...,
- _task_req: Any = ...,
+ _java_resource_profile: Optional[JavaObject] = ...,
+ ) -> None: ...
+ @overload
+ def __init__(
+ self,
+ *,
Review comment:
> ohh got it. NVM. the codes assumes it.
Yeah, it is all about control flow there. But this
```
@overload
def __init__(
self,
_java_resource_profile: None = ...,
_exec_req: Dict[str, ExecutorResourceRequest] = ...,
_task_req: Dict[str, TaskResourceRequest] = ...,
) -> None: ...
```
should have the same meaning here.
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org