Sourcery Starbot ⭐ refactored thinhnggia/NLP-progress#1
Sourcery Starbot ⭐ refactored thinhnggia/NLP-progress#1SourceryAI wants to merge 1 commit intothinhnggia:masterfrom
Conversation
| if name.endswith(":"): | ||
| name = name[:-1] | ||
|
|
||
| name = name.removesuffix(":") |
There was a problem hiding this comment.
Function sanitize_subdataset_name refactored with the following changes:
- Replace a conditional string slice with a call to
str.removesuffixorstr.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.
Function extract_lines_before_tables refactored with the following changes:
- Move setting of default value for variable into
elsebranch (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.
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.
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.
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.
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.
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
masterbranch, then run: