-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-45619: [Python] Use f-string instead of string.format #45629
Open
chilin0525
wants to merge
14
commits into
apache:main
Choose a base branch
from
chilin0525:using-f-string-instead-string-format
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+800
−997
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
66b3a5a
Refactor using f-string instead of string.format
chilin0525 f5b0933
Refactor using f-string instead of string.format
chilin0525 a5c1112
Merge branch 'main' into using-f-string-instead-string-format
chilin0525 4b46338
Rollback _filesystem_uri to test fail testcase on CI
chilin0525 02cbd03
Refactor using f-string instead of string.format
chilin0525 e63da8b
Refactor using f-string instead of string.format
chilin0525 edab1db
Refactor using f-string instead of string.format
chilin0525 0b9b9e8
Fix inconsistent f-string format in Tensor.repr method
chilin0525 c711cb0
Fix Tensor.repr method by using proper f-string formatting
chilin0525 965d70a
Merge branch 'main' into using-f-string-instead-string-format
chilin0525 6cc308f
Refactor using f-string instead of string.format for all files outsid…
chilin0525 cef7a3b
Remove to call str function in f-string
chilin0525 ffc9335
Refactor using f-string instead of string.format
chilin0525 906b7a8
Resolve conflict in _parquet.pyx
chilin0525 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
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -230,7 +230,7 @@ def __init__(self, name, handler, token=None): | |
self.github = github.Github(**kwargs) | ||
|
||
def parse_command(self, payload): | ||
mention = '@{}'.format(self.name) | ||
mention = f'@{self.name}' | ||
comment = payload['comment'] | ||
|
||
if payload['sender']['login'] == self.name: | ||
|
@@ -261,7 +261,7 @@ def handle(self, event, payload): | |
elif event == 'pull_request_review_comment': | ||
return self.handle_review_comment(command, payload) | ||
else: | ||
raise ValueError("Unexpected event type {}".format(event)) | ||
raise ValueError(f"Unexpected event type {event}") | ||
|
||
def handle_issue_comment(self, command, payload): | ||
repo = self.github.get_repo(payload['repository']['id'], lazy=True) | ||
|
@@ -291,11 +291,9 @@ def handle_issue_comment(self, command, payload): | |
comment=comment) | ||
except Exception as e: | ||
logger.exception(e) | ||
url = "{server}/{repo}/actions/runs/{run_id}".format( | ||
server=os.environ["GITHUB_SERVER_URL"], | ||
repo=os.environ["GITHUB_REPOSITORY"], | ||
run_id=os.environ["GITHUB_RUN_ID"], | ||
) | ||
url = (f"{os.environ['GITHUB_SERVER_URL']}/" | ||
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. I actually prefer the old version here, I think is is more readable with the placeholders. |
||
f"{os.environ['GITHUB_REPOSITORY']}/" | ||
f"actions/runs/{os.environ['GITHUB_RUN_ID']}") | ||
pull.create_issue_comment( | ||
f"```\n{e}\nThe Archery job run can be found at: {url}\n```") | ||
comment.create_reaction('-1') | ||
|
@@ -355,7 +353,7 @@ def _clone_arrow_and_crossbow(dest, crossbow_repo, arrow_repo_url, pr_number): | |
git.checkout(local_branch, git_dir=arrow_path) | ||
|
||
# 2. clone crossbow repository | ||
crossbow_url = 'https://github.com/{}'.format(crossbow_repo) | ||
crossbow_url = f'https://github.com/{crossbow_repo}' | ||
git.clone(crossbow_url, str(queue_path)) | ||
|
||
# 3. initialize crossbow objects | ||
|
Oops, something went wrong.
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.
Did you check that this script still runs fine according to the instructions above?