Sourcery refactored master branch#4
Open
sourcery-ai[bot] wants to merge 1 commit into
Open
Conversation
Comment on lines
-18
to
+23
| if args in _dnscache: | ||
| # print str(args) + " in cache" | ||
| return _dnscache[args] | ||
| else: | ||
| if args not in _dnscache: | ||
| # print str(args) + " not in cache" | ||
| _dnscache[args] = socket._getaddrinfo(*args, **kwargs) | ||
| return _dnscache[args] | ||
|
|
||
| # print str(args) + " in cache" | ||
| return _dnscache[args] |
Author
There was a problem hiding this comment.
Function _setDNSCache._getaddrinfo refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Swap if/else to remove empty if body (
remove-pass-body)
| # Must return an iterable of Request, dict or Item objects. | ||
| for i in result: | ||
| yield i | ||
| yield from result |
Author
There was a problem hiding this comment.
Function DoubanMovieSpiderMiddleware.process_spider_output refactored with the following changes:
- Replace yield inside for loop with yield from (
yield-from)
Comment on lines
-98
to
+97
| for r in start_requests: | ||
| yield r | ||
| yield from start_requests |
Author
There was a problem hiding this comment.
Function DoubanMovieSpiderMiddleware.process_start_requests refactored with the following changes:
- Replace yield inside for loop with yield from (
yield-from)
| for spidername in args or spider_loader.list(): | ||
| #if 'comment' in spidername: # 只并行爬取comment | ||
| if (spidername == 'douban-comment225') or (spidername == 'douban-comment250'): | ||
| if spidername in ['douban-comment225', 'douban-comment250']: |
Author
There was a problem hiding this comment.
Function Command.run refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
Author
Sourcery Code Quality Report (beta)✅ Merging this PR will increase code quality in the affected files by 0.06 out of 10.
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! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Branch
masterrefactored 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
masterbranch, then run: