Skip to content

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

Merged
merged 4 commits into from
Dec 24, 2019

Conversation

jyscao
Copy link
Contributor

@jyscao jyscao commented Dec 22, 2019

@gfyoung gfyoung added the Code Style Code style, linting, code_checks label Dec 22, 2019
@gfyoung
Copy link
Member

gfyoung commented Dec 22, 2019

@jyscao: Thanks for the contribution, and welcome to pandas ! 🚀

LGTM. Codecov failure can be ignored.

@ShaharNaveh
Copy link
Member

* [x]  closes #29547

Can you please change the word closes to ref ?

@@ -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.}"
Copy link
Member

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 :)

Copy link
Contributor Author

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.

@@ -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)})"
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
self.file_encoding = f"unknown (code={str(buf)})"
self.file_encoding = f"unknown (code={buf})"

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, thanks

@WillAyd WillAyd added this to the 1.0 milestone Dec 23, 2019
@jbrockmendel
Copy link
Member

restarted the travis build. LGTM.

)
f"Warning: column count mismatch ({self.col_count_p1} + "
f"{self.col_count_p2} != "
f"{self.column_count})\n"
)
Copy link
Member

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

@jbrockmendel jbrockmendel merged commit f97a462 into pandas-dev:master Dec 24, 2019
@jbrockmendel
Copy link
Member

Thanks @jyscao

AlexKirko pushed a commit to AlexKirko/pandas that referenced this pull request Dec 29, 2019
* CLN: str.format -> f-strings for `io/sas`

* Apply black style

* Fix syntax error

* Remove `str()` call
@jyscao jyscao deleted the convert_f-strings branch June 23, 2020 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants