-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
#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
Conversation
pandas/io/parsers.py
Outdated
@@ -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 |
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.
You accidentally deleted the 's'
here:)
infer_nrows=infer_nrows, skiprows=skiprow | |
infer_nrows=infer_nrows, skiprows=skiprows |
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 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!
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.
you don't ne
pandas/io/parsers.py
Outdated
"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__)}" |
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.
you don't need any of the repr except for this one as they are all repr'ing 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.
Should I change the other strings to something like this?
f"input was a {(type(colspecs).name)}"
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.
yesp (but you can leave anything that is not a string with repr(...)
, e.g. this one is a list
@jreback build fails if I remove repr from parsers.py. Can you help me with this issue? |
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.
also pls rebase
pandas/io/parsers.py
Outdated
"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__)}" |
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.
yesp (but you can leave anything that is not a string with repr(...)
, e.g. this one is a list
pandas/io/parsers.py
Outdated
@@ -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, " |
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.
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
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.
Noted. I'll change it tonight!
pandas/io/parsers.py
Outdated
@@ -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, " |
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.
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
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.
Ah actually I see you haven't touched this, but OK to clean up here
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.
Ill fix that for you, no problem!
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.
lgtm @jreback
thanks |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff