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 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jun 3, 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^

Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to GitHub API limits, only the first {TOTAL_COMMENTS_PER_REVIEW} comments can be shown.

Comment on lines -54 to +59
if self.timer == None:
if self.timer is None:
return
self.timer.deinit()
if len(self.callbacks) > 0:
next_pointer = self.get_next_pointer(*self.get_current_pointer())
if next_pointer == None:
if next_pointer is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRONBase._first_step refactored with the following changes:

  • Use x is None rather than x == None

for i in range(5000):
for _ in range(5000):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRONBase._wait_for_unlock_rw refactored with the following changes:

  • Replace unused for index with underscore

Comment on lines -163 to +168
if self.timer == None:
if self.timer is None:
return
self.timer.deinit()
if len(self.callbacks) > 0:
next_pointer = self.get_next_pointer(*self.get_current_pointer())
if next_pointer == None:
if next_pointer is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRON._first_step refactored with the following changes:

  • Use x is None rather than x == None

for i in range(5000):
for _ in range(5000):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRON._wait_for_unlock_rw refactored with the following changes:

  • Replace unused for index with underscore

Comment on lines -214 to +221
time_steps_validated = []
for time_step_key, (time_table_key, time_table_value) in enumerate(self.TIME_TABLE_KEYS.items()):
time_steps_validated.append(
self._validate_input(
time_table_key,
time_steps[time_step_key],
time_table_value
)
time_steps_validated = [
self._validate_input(
time_table_key, time_steps[time_step_key], time_table_value
)
for time_step_key, (time_table_key, time_table_value) in enumerate(
self.TIME_TABLE_KEYS.items()
)
]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRON.add refactored with the following changes:

  • Convert for loop into list comprehension

Comment on lines -238 to +237
for level in range(max_level + 1):
for _ in range(max_level + 1):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCounter.get_next_pointer.get_first refactored with the following changes:

  • Replace unused for index with underscore

Comment on lines -298 to +300
if _prev_data == None:
if _prev_data is None:
_prev_data = tuple()

if _time_table_node == None:
if _time_table_node is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCounter.list refactored with the following changes:

  • Use x is None rather than x == None

Comment on lines -336 to +341
if not force:
if not self.callbacks[callback_name][1]:
raise Exception('This callback cannot be removed!')
if not force and not self.callbacks[callback_name][1]:
raise Exception('This callback cannot be removed!')

max_level = len(self.TIME_TABLE_KEYS)
# [ (time_table_part, <keys to check>, <current key>) ]
time_table_parts = [[self.time_table, list(self.time_table.keys()), None]]
while len(time_table_parts) > 0:
while time_table_parts:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCounter.remove refactored with the following changes:

  • Merge nested if conditions
  • Simplify sequence comparison

if _localtime:
lt = _localtime
else:
lt = localtime()
lt = _localtime if _localtime else localtime()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRON.get_current_pointer refactored with the following changes:

  • Replace if statement with if expression

Comment on lines -79 to +76
if current_pointer == next_time_pointer:
return False
return True
return current_pointer != next_time_pointer
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SimpleCRON.next_step._next_step.is_the_same_callback refactored with the following changes:

  • Simplify conditional into return statement

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.

1 participant