-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sourcery Starbot ⭐ refactored thinhnggia/NLP-progress #1
base: master
Are you sure you want to change the base?
Conversation
if name.endswith(":"): | ||
name = name[:-1] | ||
|
||
name = name.removesuffix(":") |
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.
Function sanitize_subdataset_name
refactored with the following changes:
- Replace a conditional string slice with a call to
str.removesuffix
orstr.removeprefix
, where applicable (use-string-remove-affix
)
before = None | ||
if l.strip() != "": | ||
before = l.strip() | ||
before = l.strip() if l.strip() != "" else None |
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.
Function extract_lines_before_tables
refactored with the following changes:
- Move setting of default value for variable into
else
branch (introduce-default-else
) - Replace if statement with if expression (
assign-if-exp
)
for i in range(len(subdatasets)): | ||
out.append({ | ||
out.extend( | ||
{ | ||
"subdataset": subdatasets[i], | ||
"sota": extract_sota_table(sota_tables[i]) | ||
}) | ||
|
||
"sota": extract_sota_table(sota_tables[i]), | ||
} | ||
for i in range(len(subdatasets)) | ||
) |
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.
Function handle_multiple_sota_table_exceptions
refactored with the following changes:
- Replace a for append loop with list extend (
for-append-to-extend
)
print("WARNING: Found multiple paper references: `%s`, using only the first..." % paper_md) | ||
print( | ||
f"WARNING: Found multiple paper references: `{paper_md}`, using only the first..." | ||
) |
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.
Function extract_paper_title_and_link
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
|
||
sota = {} |
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.
Function extract_sota_table
refactored with the following changes:
- Move assignment closer to its usage within a block (
move-assign-in-block
) - Replace if statement with if expression (
assign-if-exp
) - Unwrap a constant iterable constructor (
unwrap-iterable-construction
) - Convert for loop into dictionary comprehension (
dict-comprehension
) - Merge dictionary assignment with declaration [×2] (
merge-dict-assign
) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
This removes the following comments ( why? ):
# extract all the metrics
cur = [line] | ||
else: | ||
cur = [line] | ||
cur = [line] |
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.
Function parse_markdown_file
refactored with the following changes:
- Hoist repeated code outside conditional statement [×2] (
hoist-statement-from-if
) - Use named expression to simplify assignment and conditional (
use-named-expression
)
This removes the following comments ( why? ):
# see if there is an arxiv link in the first paragraph of the description
print("Processing `%s`..." % md_file) | ||
print(f"Processing `{md_file}`...") |
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.
Function parse_markdown_directory
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: