-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
CLN: String formatting % -> f-strings #29518
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
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1bd9a95
% format to fstring!
alimcmaster1 f773a0b
Flake8
alimcmaster1 62c0c74
Black
alimcmaster1 f97f355
Updates as per comments
alimcmaster1 4af85bb
Run black format
alimcmaster1 21efbba
Merge remote-tracking branch 'remotes/upstream/master' into mcmali-pyup
alimcmaster1 3c80e0a
Update as per comments
alimcmaster1 1c3a1b1
Merge remote-tracking branch 'remotes/upstream/master' into mcmali-pyup
alimcmaster1 6f7ebe0
Update as per comments
alimcmaster1 0478bb1
Remove unrequired import
alimcmaster1 a2b6a95
Merge remote-tracking branch 'remotes/upstream/master' into mcmali-pyup
alimcmaster1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Flake8
- Loading branch information
commit f773a0b4fd9b2510ddf4dba7caacba41144d6f08
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ def __new__( | |
name=None, | ||
fastpath=None, | ||
tupleize_cols=True, | ||
**kwargs | ||
**kwargs, | ||
) -> "Index": | ||
|
||
from .range import RangeIndex | ||
|
@@ -961,7 +961,7 @@ def __repr__(self): | |
data = self._format_data() | ||
attrs = self._format_attrs() | ||
space = self._format_space() | ||
prepr = f",{space}".join(f'{k}={v}' for k, v in attrs) | ||
prepr = f",{space}".join(f"{k}={v}" for k, v in attrs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's try to minimize what we execute in f-space (better name for this?) |
||
|
||
# no data provided, just attributes | ||
if data is None: | ||
|
@@ -1471,7 +1471,10 @@ def _validate_index_level(self, level): | |
""" | ||
if isinstance(level, int): | ||
if level < 0 and level != -1: | ||
raise IndexError(f"Too many levels: Index has only 1 level, {level} is not a valid level number") | ||
raise IndexError( | ||
f"Too many levels: Index has only 1 level," | ||
f" {level} is not a valid level number" | ||
) | ||
elif level > 0: | ||
raise IndexError( | ||
"Too many levels: Index has only 1 level, not %d" % (level + 1) | ||
|
@@ -5064,7 +5067,10 @@ def get_slice_bound(self, label, side, kind): | |
assert kind in ["ix", "loc", "getitem", None] | ||
|
||
if side not in ("left", "right"): | ||
raise ValueError(f"Invalid value for side kwarg, must be either 'left' or 'right': {side}") | ||
raise ValueError( | ||
f"Invalid value for side kwarg, must be either" | ||
f" 'left' or 'right': {side}" | ||
) | ||
|
||
original_label = label | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this a
black
version thing?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.
Weirdly using 19.3b0 locally seems to add this for me - I've reverted
Uh oh!
There was an error while loading. Please reload this page.
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.
Black code check in CI fail without this - i've added this back in
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.
Personally, I find this quite odd that you have to add a comma at the end.
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.
Related to this - #29607