dchvn commented on a change in pull request #34238:
URL: https://github.com/apache/spark/pull/34238#discussion_r727989028



##########
File path: python/pyspark/context.py
##########
@@ -118,20 +125,36 @@ class SparkContext(object):
     ValueError: ...
     """
 
-    _gateway = None
-    _jvm = None
-    _next_accum_id = 0
-    _active_spark_context = None
+    _gateway: Optional[JavaGateway] = None
+    _jvm: Optional[JavaObject] = None
+    _next_accum_id: int = 0
+    _active_spark_context: Optional["SparkContext"] = None

Review comment:
       > Could you explain, why it escalated to all kinds of unrelated files 
with all the `ignore[union-attr]`?
   
   @zero323 Thanks for reviewing, as in this 
https://github.com/apache/spark/pull/34238#discussion_r726051251, when we have 
type hint ```Optional[...]``` for these attributes of ```SparkContext```, many 
places in unrelated files access them without check ```None``` for 
```SparkContext``` variable, so ```mypy check``` throws error 
`ignore[union-attr]`
   




-- 
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]

Reply via email to