ueshin commented on a change in pull request #34563:
URL: https://github.com/apache/spark/pull/34563#discussion_r747923851



##########
File path: python/pyspark/util.py
##########
@@ -369,39 +367,49 @@ class InheritableThread(threading.Thread):
     This API is experimental.
     """
 
-    def __init__(self, target, *args, **kwargs):
+    def __init__(self, target: Callable, *args: Any, **kwargs: Any):
         from pyspark import SparkContext
 
-        if isinstance(SparkContext._gateway, ClientServer):
+        if isinstance(SparkContext._gateway, ClientServer):  # type: 
ignore[attr-defined]
             # Here's when the pinned-thread mode (PYSPARK_PIN_THREAD) is on.
-            def copy_local_properties(*a, **k):
+            def copy_local_properties(*a: Any, **k: Any) -> Any:
                 # self._props is set before starting the thread to match the 
behavior with JVM.
                 assert hasattr(self, "_props")
-                
SparkContext._active_spark_context._jsc.sc().setLocalProperties(self._props)
+                
SparkContext._active_spark_context._jsc.sc().setLocalProperties(  # type: 
ignore[attr-defined]
+                    self._props
+                )
                 try:
                     return target(*a, **k)
                 finally:
                     InheritableThread._clean_py4j_conn_for_current_thread()
 
-            super(InheritableThread, 
self).__init__(target=copy_local_properties, *args, **kwargs)
+            super(InheritableThread, self).__init__(
+                target=copy_local_properties, *args, **kwargs  # type: 
ignore[misc]
+            )
         else:
-            super(InheritableThread, self).__init__(target=target, *args, 
**kwargs)
+            super(InheritableThread, self).__init__(
+                target=target, *args, **kwargs  # type: ignore[misc]
+            )

Review comment:
       ```
   python/pyspark/util.py:390: error: "__init__" of "Thread" gets multiple 
values for keyword argument "target"  [misc]
   ```

##########
File path: python/pyspark/util.py
##########
@@ -369,39 +367,49 @@ class InheritableThread(threading.Thread):
     This API is experimental.
     """
 
-    def __init__(self, target, *args, **kwargs):
+    def __init__(self, target: Callable, *args: Any, **kwargs: Any):
         from pyspark import SparkContext
 
-        if isinstance(SparkContext._gateway, ClientServer):
+        if isinstance(SparkContext._gateway, ClientServer):  # type: 
ignore[attr-defined]
             # Here's when the pinned-thread mode (PYSPARK_PIN_THREAD) is on.
-            def copy_local_properties(*a, **k):
+            def copy_local_properties(*a: Any, **k: Any) -> Any:
                 # self._props is set before starting the thread to match the 
behavior with JVM.
                 assert hasattr(self, "_props")
-                
SparkContext._active_spark_context._jsc.sc().setLocalProperties(self._props)
+                
SparkContext._active_spark_context._jsc.sc().setLocalProperties(  # type: 
ignore[attr-defined]
+                    self._props
+                )
                 try:
                     return target(*a, **k)
                 finally:
                     InheritableThread._clean_py4j_conn_for_current_thread()
 
-            super(InheritableThread, 
self).__init__(target=copy_local_properties, *args, **kwargs)
+            super(InheritableThread, self).__init__(
+                target=copy_local_properties, *args, **kwargs  # type: 
ignore[misc]
+            )

Review comment:
       ```
   python/pyspark/util.py:386: error: "__init__" of "Thread" gets multiple 
values for keyword argument "target"  [misc]
   ```




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