Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Added contains to Column #547

Merged
merged 3 commits into from May 19, 2021
Merged

Added contains to Column #547

merged 3 commits into from May 19, 2021

Conversation

Braamling
Copy link
Contributor

@Braamling Braamling commented May 3, 2021

The contains method is missing from the stubs causing mypy to raise error: "Column" not callable.

This PR adds the typehints to 2.4 specifically (the version we are using), but it should probably also be added to the other versions.

@Braamling
Copy link
Contributor Author

@zero323 would you be able to take a look?

@@ -81,6 +81,7 @@ class Column:
def alias(self, *alias: str, **kwargs: Any) -> Column: ...
def name(self, *alias: str) -> Column: ...
def cast(self, dataType: Union[DataType, str]) -> Column: ...
def contains(self, other: Union[DataType, str]) -> Column: ...
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prefer to keep this consistent with upstream and have Any here (see apache/spark#31823 (review))

@zero323
Copy link
Owner

zero323 commented May 14, 2021

Thank you for your proposal and sorry for a delayed response ‒ I am not much around here these days.

@Braamling
Copy link
Contributor Author

Thanks @zero323, I've changed the type to Any. Does this look better?

@zero323 zero323 merged commit 7fff0d5 into zero323:branch-2.4 May 19, 2021
zero323 pushed a commit that referenced this pull request May 19, 2021
* added contains to Column

* Made contains consistent with upstream

* Remove accidentally union between DataType and Any

Co-authored-by: Bram van den Akker <bram.vandenakker@booking.com>
@zero323
Copy link
Owner

zero323 commented May 19, 2021

Thanks @Braamling Merged into branch-2.4 and branch-3.0

@Braamling
Copy link
Contributor Author

@zero323 would it be possible to deploy this fix into the stubs for 2.4? We frequently run into this issue and would like to use the updates stubs :)

@zero323
Copy link
Owner

zero323 commented Aug 5, 2021

Not a problem @Braamling

Deployed to PyPi:

I'll handle conda forge once bot prepares the PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants