Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Series.dtype return annotation #1049

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below.

@github-actions github-actions bot added the enhancement New feature or request label Sep 23, 2024
@FBruzzesi FBruzzesi changed the title feat: add dtype return annotation feat: add Series.dtype return annotation Sep 23, 2024
@@ -302,7 +303,7 @@ def len(self) -> int:
return len(self._compliant_series)

@property
def dtype(self) -> Any:
def dtype(self: Self) -> DType:
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

@@ -359,7 +359,7 @@ def alias(self, name: str) -> Self:
)

@property
def dtype(self) -> DType:
def dtype(self: Self) -> DType:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe it's needed

Suggested change
def dtype(self: Self) -> DType:
def dtype(self) -> DType:

But if it is... Can you please teach me why? Thank you

Copy link
Member Author

Choose a reason for hiding this comment

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

I took this as opportunity to go a bit banana into hints for the rest of the codebase (uncommitted here). When we know that self: Self, then self._native_series is known to be a pa.ChunkedArray, which has a type property.

Probably some editors do not need it anyway πŸ˜‡

Copy link
Member

Choose a reason for hiding this comment

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

sounds like something which editors should fix πŸ˜„ but in the meantime, if this helps the development workflow, then it seems like a good idea to add it πŸ‘

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @FBruzzesi !

@FBruzzesi FBruzzesi merged commit 5281c40 into main Sep 23, 2024
27 checks passed
@MarcoGorelli MarcoGorelli deleted the fix/dtype-return-annotation branch October 2, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enh]: Export nw.DType from Series's .dtype property
3 participants