-
-
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
Conversation
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.
Thanks @jbrockmendel. f-string suggestion and minor query otherwise lgtm.
@@ -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))) |
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
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 comment
The reason will be displayed to describe this comment to others. Learn more.
same
if self.categories is None: | ||
data = "None, " | ||
else: | ||
data = self.categories._format_data(name=self.__class__.__name__) | ||
return tpl.format(data, self._ordered) | ||
return tpl.format(data=data, ordered=self._ordered) |
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.
same
can you rebase |
rebased+green |
thanks |
Some docstring cleanup.