-
-
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 refactored master branch #2
Conversation
c124228
to
56b52ba
Compare
if (hasattr(os, "devnull")): | ||
DEVNULL = os.devnull | ||
else: | ||
DEVNULL = "/dev/null" | ||
DEVNULL = os.devnull if hasattr(os, "devnull") else "/dev/null" |
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 DaemonClass.__init__ refactored with the following changes:
- Replace if statement with if expression
|
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 DaemonClass.restart refactored with the following changes:
- Remove redundant pass statement
for i in range(1000): | ||
for _ in range(1000): |
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.
Lines 24-24 refactored with the following changes:
- Replace unused for index with underscore
if req.method in ('POST', 'PUT'): | ||
if 'application/json' not in req.content_type: | ||
raise falcon.HTTPUnsupportedMediaType( | ||
'This API only supports requests encoded as JSON.', | ||
href='http://docs.examples.com/api/json') | ||
if ( | ||
req.method in ('POST', 'PUT') | ||
and 'application/json' not in req.content_type | ||
): | ||
raise falcon.HTTPUnsupportedMediaType( | ||
'This API only supports requests encoded as JSON.', | ||
href='http://docs.examples.com/api/json') |
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 RequireJSON.process_request refactored with the following changes:
- Merge nested if conditions
if not (key[0:5] == '_obj_' | ||
or key[0:7] == '_change' | ||
or key == '_context' | ||
or key in list(self.fields) | ||
or key == 'FIELDS' | ||
or key == 'VERSION' | ||
or key == 'fields'): | ||
if ( | ||
key[0:5] != '_obj_' | ||
and key[0:7] != '_change' | ||
and key != '_context' | ||
and key not in list(self.fields) | ||
and key != 'FIELDS' | ||
and key != 'VERSION' | ||
and key != 'fields' | ||
): |
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 TestObject.__setattr__ refactored with the following changes:
- Simplify logical expression
return sum( | ||
[random.randint(1, 100) for i in range(100000)]) | ||
return sum(random.randint(1, 100) for i in range(100000)) |
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 compute refactored with the following changes:
- Replace unneeded comprehension with generator
return sum( | ||
[random.randint(1, 100) for i in range(100000)]) | ||
return sum(random.randint(1, 100) for i in range(100000)) |
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 compute refactored with the following changes:
- Replace unneeded comprehension with generator
return sum( | ||
[random.randint(1, 100) for i in range(100000)]) | ||
return sum(random.randint(1, 100) for i in range(100000)) |
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 compute refactored with the following changes:
- Replace unneeded comprehension with generator
if not all(k in values for k in required): | ||
if any(k not in values for k in required): |
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 new_transaction refactored with the following changes:
- Simplify inverted any() and all() calls
READ_WEBSOCKET_DELAY = 1 # 1 second delay between reading from firehose | ||
if slack_client.rtm_connect(): | ||
print("StarterBot connected and running!") | ||
READ_WEBSOCKET_DELAY = 1 # 1 second delay between reading from firehose |
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 listen_sync refactored with the following changes:
- Move assignments closer to their usage
Sourcery refactored master branch
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: