Skip to content

Conversation

@zero323
Copy link
Member

@zero323 zero323 commented Dec 25, 2021

What changes were proposed in this pull request?

Inline annotations for pyspark.mllib.linalg.__init__.py

Why are the changes needed?

Currently, there is type hint stub files pyspark.mllib.linalg.__init__.pyi to show the expected types for functions, but we can also take advantage of static type checking within the functions by inlining the type hints.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentionally simplified compared to pyi implementation ‒ there seems to be no advantage of keeping original overloads.

Comment on lines +1484 to +1486
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, mypy doesn't recognize ndarray.tostring.

@zero323 zero323 changed the title [WIP][SPARK-37429][PYTHON][MLLIB] Inline annotations for pyspark.mllib.linalg.__init__.py [SPARK-37429][PYTHON][MLLIB] Inline annotations for pyspark.mllib.linalg.__init__.py Dec 28, 2021
@zero323 zero323 marked this pull request as ready for review December 28, 2021 00:19
@HyukjinKwon
Copy link
Member

cc @WeichenXu123 .

If there are no reviews being done, I would be fine to go ahead as are. I will leave it to you @zero323 - I have less background on ML side ..

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zero323 zero323 closed this in b12fc70 Jan 14, 2022
@zero323
Copy link
Member Author

zero323 commented Jan 14, 2022

Merged into master.

@zero323 zero323 deleted the SPARK-37429 branch January 14, 2022 17:47
dchvn pushed a commit to dchvn/spark that referenced this pull request Jan 19, 2022
…alg.__init__.py

### What changes were proposed in this pull request?

Inline annotations for `pyspark.mllib.linalg.__init__.py`

### Why are the changes needed?

Currently, there is type hint stub files  `pyspark.mllib.linalg.__init__.pyi` to show the expected types for functions, but we can also take advantage of static type checking within the functions by inlining the type hints.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing tests.

Closes apache#35020 from zero323/SPARK-37429.

Authored-by: zero323 <mszymkiewicz@gmail.com>
Signed-off-by: zero323 <mszymkiewicz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants