You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/11/13 06:34:26 UTC
[spark] branch master updated: [SPARK-37139][PYTHON][FOLLOWUP] Fix class variable type hints in taskcontext.py
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new fd6079d [SPARK-37139][PYTHON][FOLLOWUP] Fix class variable type hints in taskcontext.py
fd6079d is described below
commit fd6079d72e6579d85066a430d30d082259165c0e
Author: Takuya UESHIN <ue...@databricks.com>
AuthorDate: Sat Nov 13 15:33:45 2021 +0900
[SPARK-37139][PYTHON][FOLLOWUP] Fix class variable type hints in taskcontext.py
### What changes were proposed in this pull request?
Fixes class variable type hints in taskcontext.py.
### Why are the changes needed?
In `taskcontext.py`, a variable `_taskContext` should be annotated as `ClassVar` of `TaskContext`.
Also, `_port` and `_secret` of `BarrierTaskContext ` should be annotated.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
`lint-python` should pass.
Closes #34574 from ueshin/issues/SPARK-37139/taskcontext.
Authored-by: Takuya UESHIN <ue...@databricks.com>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
python/pyspark/taskcontext.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/python/pyspark/taskcontext.py b/python/pyspark/taskcontext.py
index ebfcfcd..7333a68 100644
--- a/python/pyspark/taskcontext.py
+++ b/python/pyspark/taskcontext.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-from typing import Type, Dict, List, Optional, Union, cast
+from typing import ClassVar, Type, Dict, List, Optional, Union, cast
from pyspark.java_gateway import local_connect_and_auth
from pyspark.resource import ResourceInformation
@@ -29,7 +29,7 @@ class TaskContext(object):
:meth:`TaskContext.get`.
"""
- _taskContext: Optional["TaskContext"] = None
+ _taskContext: ClassVar[Optional["TaskContext"]] = None
_attemptNumber: Optional[int] = None
_partitionId: Optional[int] = None
@@ -171,8 +171,8 @@ class BarrierTaskContext(TaskContext):
This API is experimental
"""
- _port = None
- _secret = None
+ _port: ClassVar[Optional[Union[str, int]]] = None
+ _secret: ClassVar[Optional[str]] = None
@classmethod
def _getOrCreate(cls: Type["BarrierTaskContext"]) -> "BarrierTaskContext":
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org