Skip to content
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

Merged
merged 1 commit into from
Jun 11, 2020
Merged

Sourcery refactored master branch #2

merged 1 commit into from
Jun 11, 2020

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jun 11, 2020

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:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

if (hasattr(os, "devnull")):
DEVNULL = os.devnull
else:
DEVNULL = "/dev/null"
DEVNULL = os.devnull if hasattr(os, "devnull") else "/dev/null"
Copy link
Author

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

Comment on lines -329 to +326

Copy link
Author

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):
Copy link
Author

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

Comment on lines -87 to +93
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')
Copy link
Author

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

Comment on lines -20 to +28
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'
):
Copy link
Author

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))
Copy link
Author

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))
Copy link
Author

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))
Copy link
Author

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):
Copy link
Author

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

Comment on lines -46 to +48
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
Copy link
Author

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

@ntk148v ntk148v merged commit 0dbbbd6 into master Jun 11, 2020
ntk148v added a commit that referenced this pull request Mar 31, 2022
Sourcery refactored master branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants