Sourcery refactored master branch - #17
Open
sourcery-ai[bot] wants to merge 1 commit into
Open
Conversation
sourcery-ai
Bot
force-pushed
the
sourcery/master
branch
from
June 4, 2020 12:45
1bfee28 to
5d0e89c
Compare
| if int(s[1]) < int(s[0]): | ||
| return False | ||
| return True | ||
| return int(s[1]) >= int(s[0]) |
Author
There was a problem hiding this comment.
Function RangeAction.__call__.is_valid_year_range refactored with the following changes:
- Simplify conditional into return statement
Comment on lines
-85
to
+92
| if "%(default)" not in action.help: | ||
| if action.default is not argparse.SUPPRESS: | ||
| defaulting_nargs = [argparse.OPTIONAL, argparse.ZERO_OR_MORE] | ||
| if action.option_strings or action.nargs in defaulting_nargs: | ||
| if type(action.default) == list: | ||
| help += " (default: %d-%d)" % ( | ||
| action.default[0], | ||
| action.default[-1], | ||
| ) | ||
| else: | ||
| help += " (default: %(default)s)" | ||
| if "%(default)" not in help and action.default is not argparse.SUPPRESS: | ||
| defaulting_nargs = [argparse.OPTIONAL, argparse.ZERO_OR_MORE] | ||
| if action.option_strings or action.nargs in defaulting_nargs: | ||
| if type(action.default) == list: | ||
| help += " (default: %d-%d)" % ( | ||
| action.default[0], | ||
| action.default[-1], | ||
| ) | ||
| else: | ||
| help += " (default: %(default)s)" |
Author
There was a problem hiding this comment.
Function _get_help_string refactored with the following changes:
- Merge nested if conditions
- Swap positions of nested conditionals
- Hoist repeated code outside conditional statement
- Use previously assigned local variable
|
|
||
| def _find_config() -> Path: | ||
| """ look for cfgFile in the default locations """ | ||
| cfgFile = None |
Author
There was a problem hiding this comment.
Function _find_config refactored with the following changes:
- Inline variable that is only used once
| infiles.sort() | ||
|
|
||
| if len(infiles) == 0: | ||
| if not infiles: |
Author
There was a problem hiding this comment.
Function _select_files refactored with the following changes:
- Simplify sequence comparison
Comment on lines
-237
to
+238
| # TODO: the control flow here should be more obvious | ||
| if len(dfs) == 0: | ||
| # TODO: the control flow here should be more obvious | ||
| if not dfs: |
Author
There was a problem hiding this comment.
Function read_ldndc_txt refactored with the following changes:
- Simplify sequence comparison
|
|
||
| def identical(elements: List) -> bool: | ||
| return all([e == elements[0] for e in elements]) | ||
| return all(e == elements[0] for e in elements) |
Author
There was a problem hiding this comment.
Function identical refactored with the following changes:
- Replace unneeded comprehension with generator
Comment on lines
-22
to
+28
| if l == "]": | ||
| elif l == "]": | ||
| cnt -= 1 | ||
| if cnt == 0: | ||
| cnt_closed += 1 | ||
| elif cnt < 0: | ||
| return False | ||
| if cnt_closed > 1: | ||
| return False | ||
| return True | ||
| return cnt_closed <= 1 |
Author
There was a problem hiding this comment.
Function valid_brackets refactored with the following changes:
- Simplify conditional into switch-like form
- Simplify conditional into return statement
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: