-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery refactored master branch #17
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
base: master
Are you sure you want to change the base?
Conversation
1bfee28 to
5d0e89c
Compare
| if int(s[1]) < int(s[0]): | ||
| return False | ||
| return True | ||
| return int(s[1]) >= int(s[0]) |
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 RangeAction.__call__.is_valid_year_range refactored with the following changes:
- Simplify conditional into return statement
| 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)" |
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 _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 |
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 _find_config refactored with the following changes:
- Inline variable that is only used once
| infiles.sort() | ||
|
|
||
| if len(infiles) == 0: | ||
| if not infiles: |
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 _select_files refactored with the following changes:
- Simplify sequence comparison
| # 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: |
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 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) |
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 identical refactored with the following changes:
- Replace unneeded comprehension with generator
| 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 |
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 valid_brackets refactored with the following changes:
- Simplify conditional into switch-like form
- Simplify conditional into return statement
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: