Skip to content

#29886 - Replace !r for repr() on pandas/io/parses.py #30073

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 16 commits into from
Dec 10, 2019

Conversation

JvPy
Copy link
Contributor

@JvPy JvPy commented Dec 5, 2019

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@gfyoung gfyoung added Refactor Internal refactoring of code Strings String extension data type and string data labels Dec 5, 2019
@@ -3600,15 +3600,15 @@ def __init__(self, f, colspecs, delimiter, comment, skiprows=None, infer_nrows=1
self.comment = comment
if colspecs == "infer":
self.colspecs = self.detect_colspecs(
infer_nrows=infer_nrows, skiprows=skiprows
infer_nrows=infer_nrows, skiprows=skiprow
Copy link
Member

@ShaharNaveh ShaharNaveh Dec 5, 2019

Choose a reason for hiding this comment

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

You accidentally deleted the 's' here:)

Suggested change
infer_nrows=infer_nrows, skiprows=skiprow
infer_nrows=infer_nrows, skiprows=skiprows

Copy link
Contributor Author

@JvPy JvPy Dec 5, 2019

Choose a reason for hiding this comment

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

I did, sry :(
I made another PR with the fix, but it failed

I can make another PR with the fix + some other files from the list tonight, if you want

Ps: This is my first time contributing!

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

you don't ne

"column specifications must be a list or tuple, "
"input was a %r" % type(colspecs).__name__
f"column specifications must be a list or tuple, "
f"input was a {repr(type(colspecs).__name__)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need any of the repr except for this one as they are all repr'ing strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I change the other strings to something like this?

f"input was a {(type(colspecs).name)}"

Copy link
Contributor

Choose a reason for hiding this comment

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

yesp (but you can leave anything that is not a string with repr(...), e.g. this one is a list

@pep8speaks
Copy link

pep8speaks commented Dec 8, 2019

Hello @JvPy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-12-09 23:02:20 UTC

@JvPy
Copy link
Contributor Author

JvPy commented Dec 8, 2019

@jreback build fails if I remove repr from parsers.py. Can you help me with this issue?

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

also pls rebase

"column specifications must be a list or tuple, "
"input was a %r" % type(colspecs).__name__
f"column specifications must be a list or tuple, "
f"input was a {repr(type(colspecs).__name__)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

yesp (but you can leave anything that is not a string with repr(...), e.g. this one is a list

@@ -3607,8 +3607,8 @@ def __init__(self, f, colspecs, delimiter, comment, skiprows=None, infer_nrows=1

if not isinstance(self.colspecs, (tuple, list)):
raise TypeError(
"column specifications must be a list or tuple, "
"input was a %r" % type(colspecs).__name__
f"column specifications must be a list or tuple, "
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
f"column specifications must be a list or tuple, "
"column specifications must be a list or tuple, "

The f prefix is only needed if actually substituting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted. I'll change it tonight!

@@ -1080,7 +1080,7 @@ def _clean_options(self, options, engine):
if not isinstance(converters, dict):
raise TypeError(
f"Type converters must be a dict or subclass, "
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
f"Type converters must be a dict or subclass, "
"Type converters must be a dict or subclass, "

I think I missed this in last review if you want to accept commit on GitHub

Copy link
Member

Choose a reason for hiding this comment

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

Ah actually I see you haven't touched this, but OK to clean up here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ill fix that for you, no problem!

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm @jreback

@WillAyd WillAyd added this to the 1.0 milestone Dec 10, 2019
@jreback jreback merged commit b164624 into pandas-dev:master Dec 10, 2019
@jreback
Copy link
Contributor

jreback commented Dec 10, 2019

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants