Skip to content

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 8 commits into from
Nov 12, 2019
Merged

CLN: annotations in core.dtypes #29503

merged 8 commits into from
Nov 12, 2019

Conversation

jbrockmendel
Copy link
Member

Some docstring cleanup.

Copy link
Member

@simonjayhawkins simonjayhawkins left a 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)))
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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(
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

same

@simonjayhawkins simonjayhawkins added Docs Typing type annotations, mypy/pyright type checking labels Nov 9, 2019
@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Nov 9, 2019
@jreback
Copy link
Contributor

jreback commented Nov 11, 2019

can you rebase

@jbrockmendel
Copy link
Member Author

rebased+green

@jreback jreback merged commit eabf89d into pandas-dev:master Nov 12, 2019
@jreback
Copy link
Contributor

jreback commented Nov 12, 2019

thanks

@jbrockmendel jbrockmendel deleted the clner branch November 12, 2019 23:55
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants