Skip to content

[SPARK-56224][PYTHON] Polish type annotations for accumulators.py#55023

Closed
gaogaotiantian wants to merge 1 commit intoapache:masterfrom
gaogaotiantian:mypy-accumulator
Closed

[SPARK-56224][PYTHON] Polish type annotations for accumulators.py#55023
gaogaotiantian wants to merge 1 commit intoapache:masterfrom
gaogaotiantian:mypy-accumulator

Conversation

@gaogaotiantian
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Reduced the number of type ignores in accumulators.py by

  • Adding asserts to types that we are sure
  • Use correct import mechanism
  • Support basic types for type var
  • Forward type declaration for variables assigned separately in if/else

Why are the changes needed?

We want less "exceptions" (in this case, type: ignore) in our code base. Type checker would be more helpful if we have less exceptions.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

mypy passed locally.

Was this patch authored or co-authored using generative AI tooling?

No.

@zhengruifeng
Copy link
Copy Markdown
Contributor

merged to master

@gaogaotiantian gaogaotiantian deleted the mypy-accumulator branch April 2, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants