Anna Liang created SPARK-60174:
----------------------------------

             Summary: Remove type: ignore[union-attr] in 
pyspark.sql.worker.utils
                 Key: SPARK-60174
                 URL: https://issues.apache.org/jira/browse/SPARK-60174
             Project: Spark
          Issue Type: Improvement
          Components: PySpark
    Affects Versions: 4.4.0
            Reporter: Anna Liang


`worker_run` in python/pyspark/sql/worker/utils.py suppresses a mypy
`union-attr` error on `sys.modules["__main__"].__spec__.name` with
`# type: ignore[union-attr]`, because `__spec__` is typed as
`ModuleSpec | None`.

Narrow the type explicitly by storing `__spec__` in a local variable and
checking `is not None`, then remove the `type: ignore`. Behavior is unchanged.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to