-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: annotations in core.dtypes #29503
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5422f99
core.dtypes annotations
jbrockmendel 3d4f321
dype annotation
jbrockmendel e05905f
dtypes annotatitons
jbrockmendel f3cc917
dtypes annotations
jbrockmendel 7475e58
dtypes annotations
jbrockmendel 8bfd702
Merge branch 'master' of https://github.com/pandas-dev/pandas into clner
jbrockmendel f2875e1
revert to punt
jbrockmendel 35fe7ca
Merge branch 'master' of https://github.com/pandas-dev/pandas into clner
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,8 @@ def __str__(self) -> str: | |
return self.name | ||
|
||
def __eq__(self, other): | ||
"""Check whether 'other' is equal to self. | ||
""" | ||
Check whether 'other' is equal to self. | ||
|
||
By default, 'other' is considered equal if either | ||
|
||
|
@@ -115,7 +116,7 @@ def __eq__(self, other): | |
) | ||
return False | ||
|
||
def __hash__(self): | ||
def __hash__(self) -> int: | ||
return hash(tuple(getattr(self, attr) for attr in self._metadata)) | ||
|
||
def __ne__(self, other): | ||
|
@@ -171,7 +172,8 @@ def name(self) -> str: | |
|
||
@property | ||
def names(self) -> Optional[List[str]]: | ||
"""Ordered list of field names, or None if there are no fields. | ||
""" | ||
Ordered list of field names, or None if there are no fields. | ||
|
||
This is for compatibility with NumPy arrays, and may be removed in the | ||
future. | ||
|
@@ -233,16 +235,19 @@ def construct_from_string(cls, string: str): | |
... "'{}'".format(cls.__name__, string)) | ||
""" | ||
if not isinstance(string, str): | ||
raise TypeError("Expects a string, got {}".format(type(string))) | ||
raise TypeError("Expects a string, got {typ}".format(typ=type(string))) | ||
if string != cls.name: | ||
raise TypeError( | ||
"Cannot construct a '{}' from '{}'".format(cls.__name__, string) | ||
"Cannot construct a '{cls}' from '{string}'".format( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
cls=cls.__name__, string=string | ||
) | ||
) | ||
return cls() | ||
|
||
@classmethod | ||
def is_dtype(cls, dtype) -> bool: | ||
"""Check if we match 'dtype'. | ||
""" | ||
Check if we match 'dtype'. | ||
|
||
Parameters | ||
---------- | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if changing .format could now use f-strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh golly, im still tracking down %-based usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a go at upgrading some of our % usage - hopefully there isn't too much more!
https://github.com/pandas-dev/pandas/pull/29518/files