-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: str.format -> f-strings for io/sas
#30409
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
@jyscao: Thanks for the contribution, and welcome to LGTM. Codecov failure can be ignored. |
Can you please change the word |
pandas/io/sas/sas_xport.py
Outdated
@@ -367,8 +367,8 @@ def _read_header(self): | |||
fl = field["field_length"] | |||
if field["ntype"] == "numeric" and ((fl < 2) or (fl > 8)): | |||
self.close() | |||
msg = "Floating field width {0} is not between 2 and 8." | |||
raise TypeError(msg.format(fl)) | |||
msg = "f{Floating field width {fl} is not between 2 and 8.}" |
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.
The f
is inside the 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.
How very sloppy of me... Good eye, it has been fixed now.
a7d0c0b
to
0916a04
Compare
pandas/io/sas/sas7bdat.py
Outdated
@@ -169,7 +169,7 @@ def _get_properties(self): | |||
if buf in const.encoding_names: | |||
self.file_encoding = const.encoding_names[buf] | |||
else: | |||
self.file_encoding = "unknown (code={name!s})".format(name=buf) | |||
self.file_encoding = f"unknown (code={str(buf)})" |
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.
self.file_encoding = f"unknown (code={str(buf)})" | |
self.file_encoding = f"unknown (code={buf})" |
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 think we've been cleaning these up elsewhere; shouldn't need the str()
call
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.
changed, thanks
restarted the travis build. LGTM. |
) | ||
f"Warning: column count mismatch ({self.col_count_p1} + " | ||
f"{self.col_count_p2} != " | ||
f"{self.column_count})\n" | ||
) |
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.
for follow-up, this probably should use warnings rather than print
Thanks @jyscao |
* CLN: str.format -> f-strings for `io/sas` * Apply black style * Fix syntax error * Remove `str()` call
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff