Conversation
| exec(open('%s/.pythonpy.py' % os.environ['HOME']).read()) | ||
| exec(open(f"{os.environ['HOME']}/.pythonpy.py").read()) | ||
| except: | ||
| pass | ||
|
|
There was a problem hiding this comment.
Lines 26-29 refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| module = __import__(module_name) | ||
| globals()[raw_module_name] = module | ||
| import_matches(query, prefix='%s.' % module_name) | ||
| import_matches(query, prefix=f'{module_name}.') |
There was a problem hiding this comment.
Function import_matches refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| if args.ignore_exceptions: | ||
| pass | ||
| else: | ||
| if not args.ignore_exceptions: |
There was a problem hiding this comment.
Function loads refactored with the following changes:
- Swap if/else to remove empty if body (
remove-pass-body)
| entry_points_scripts.append(py_entry % e) | ||
| entry_points_scripts.append(pycompleter_entry % e) | ||
|
|
||
| entry_points_scripts.extend((py_entry % e, pycompleter_entry % e)) |
There was a problem hiding this comment.
Lines 10-12 refactored with the following changes:
- Merge consecutive list appends into a single extend (
merge-list-appends-into-extend)
| module = __import__(module_name) | ||
| globals()[raw_module_name] = module | ||
| import_matches(query, prefix='%s.' % module_name) | ||
| import_matches(query, prefix=f'{module_name}.') |
There was a problem hiding this comment.
Function import_matches refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| if args.ignore_exceptions: | ||
| pass | ||
| else: | ||
| if not args.ignore_exceptions: |
There was a problem hiding this comment.
Function loads refactored with the following changes:
- Swap if/else to remove empty if body (
remove-pass-body)
| l = list() | ||
| l = [] | ||
| if completion_args['c_arg']: | ||
| exec(completion_args['c_arg'].strip('"\'').replace("`", "'")) | ||
| context = locals() | ||
| context.update(globals()) | ||
| context = locals() | globals() |
There was a problem hiding this comment.
Function complete_all refactored with the following changes:
- Replace list() with [] (
list-literal) - Merge dictionary updates via the union operator [×2] (
dict-assign-update-to-union) - Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| if m: | ||
| modules.append(m.group('name')) | ||
| modules.append(m['name']) | ||
| return list(set(modules)) | ||
|
|
There was a problem hiding this comment.
Function get_completerlib refactored with the following changes:
- Replace m.group(x) with m[x] for re.Match objects (
use-getitem-for-re-match-groups) - Simplify logical expression using De Morgan identities (
de-morgan)
| if str_.endswith('('): | ||
| return str_[:-1] | ||
| return str_ | ||
| return str_[:-1] if str_.endswith('(') else str_ |
There was a problem hiding this comment.
Function remove_trailing_paren refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else) - Replace if statement with if expression (
assign-if-exp)
| if len(options) == 0: | ||
| if not options: | ||
| return | ||
|
|
||
| if len(current_list(input)) > 1 and max(map(len, options)) + 1 >= len(current_raw(input)): | ||
| options.append(current_prefix(input)) | ||
|
|
||
| if len(options) <= 1: | ||
| options = options + [x + "'" for x in options] | ||
| options += [x + "'" for x in options] |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Simplify sequence length comparison (
simplify-len-comparison) - Replace assignment with augmented assignment (
aug-assign)
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:Help us improve this pull request!