-
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 #6
base: master
Are you sure you want to change the base?
Conversation
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.
Due to GitHub API limits, only the first {TOTAL_COMMENTS_PER_REVIEW} comments can be shown.
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: |
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 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): |
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 SimpleCRONBase._wait_for_unlock_rw refactored with the following changes:
- Replace unused for index with underscore
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: |
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 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): |
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 SimpleCRON._wait_for_unlock_rw refactored with the following changes:
- Replace unused for index with underscore
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() | ||
) | ||
] |
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 SimpleCRON.add refactored with the following changes:
- Convert for loop into list comprehension
for level in range(max_level + 1): | ||
for _ in range(max_level + 1): |
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 SimpleCounter.get_next_pointer.get_first refactored with the following changes:
- Replace unused for index with underscore
if _prev_data == None: | ||
if _prev_data is None: | ||
_prev_data = tuple() | ||
|
||
if _time_table_node == None: | ||
if _time_table_node is None: |
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 SimpleCounter.list refactored with the following changes:
- Use x is None rather than x == None
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: |
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 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() |
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 SimpleCRON.get_current_pointer refactored with the following changes:
- Replace if statement with if expression
if current_pointer == next_time_pointer: | ||
return False | ||
return True | ||
return current_pointer != next_time_pointer |
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 SimpleCRON.next_step._next_step.is_the_same_callback refactored with the following changes:
- Simplify conditional into return statement
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: