-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
ids = set(line.split()[1].decode() for line in h if line.startswith(b'ID')) | ||
inserted_ids = set(e.name for e in self.db) | ||
ids = {line.split()[1].decode() for line in h if line.startswith(b'ID')} | ||
inserted_ids = {e.name for e in self.db} |
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 SeqDBTest.test_update
refactored with the following changes:
- Replace list(), dict() or set() with comprehension [×2] (
collection-builtin-to-comprehension
)
self.assertEqual(len(set(e.name for e in self.db)), 70) | ||
self.assertEqual(len({e.name for e in self.db}), 70) |
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 SeqDBTest.test_update_filtered
refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension
)
db_host = os.environ.get('TEST_DB_HOST') | ||
if db_host: | ||
if db_host := os.environ.get('TEST_DB_HOST'): |
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 MongoTest.setUp
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
db_host = os.environ.get('TEST_DB_HOST') | ||
|
||
if db_host: | ||
if db_host := os.environ.get('TEST_DB_HOST'): |
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 AsyncTest.setUp
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if t is None: | ||
return None | ||
r = self._extract_seqrecord(t['raw_record']) | ||
return r | ||
return None if t is None else self._extract_seqrecord(t['raw_record']) |
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 MongoDatabase.get_item
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
) - Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
good = base_taxa in good_taxa | ||
return good | ||
return base_taxa in good_taxa |
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 filter_proks
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
print("Updating {}".format(taxon)) | ||
print(f"Updating {taxon}") |
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 SeqDB.update_trembl_taxa
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
s = process_main(flatfiles, host, | ||
dbtype=dbtype, initialize=True, verbose=True, n_jobs=n_jobs, **kwargs) | ||
|
||
return s | ||
return process_main( | ||
flatfiles, | ||
host, | ||
dbtype=dbtype, | ||
initialize=True, | ||
verbose=True, | ||
n_jobs=n_jobs, | ||
**kwargs | ||
) |
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 create_index
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
for x in range(retries): | ||
for _ in range(retries): |
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 search_uniprot
refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore
)
if num_seqs: | ||
pbar = tqdm(total=num_seqs) | ||
else: | ||
pbar = tqdm() | ||
pbar = tqdm(total=num_seqs) if num_seqs else tqdm() |
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 process_main
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
) - Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.08%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Branch
master
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run:Help us improve this pull request!