Conversation
| print('%s removed ...' % item) | ||
| print(f'{item} removed ...') | ||
| except OSError: | ||
| try: | ||
| shutil.rmtree(item) | ||
| print('%s/ removed ...' % item) | ||
| print(f'{item}/ removed ...') |
There was a problem hiding this comment.
Function rmtree_glob refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| pages = [ | ||
| HelpPage(parent=parent, | ||
| bitmap=wx.Bitmap(bitmap_file), | ||
| caption=caption) | ||
| return [ | ||
| HelpPage(parent=parent, bitmap=wx.Bitmap(bitmap_file), caption=caption) | ||
| for [caption, bitmap_file] in help_images_list | ||
| ] | ||
|
|
||
| return pages |
There was a problem hiding this comment.
Function page_list refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
|
|
||
| def __repr__(self): | ||
| return "Vector(" + tuple.__repr__(self) + ")" | ||
| return f"Vector({tuple.__repr__(self)})" |
There was a problem hiding this comment.
Function Vector.__repr__ refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| def push(self, command): | ||
| more = self.runsource(command, self.filename) | ||
| return more | ||
| return self.runsource(command, self.filename) |
There was a problem hiding this comment.
Function Console.push refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| if more: | ||
| pass # prompt = sys.ps2 | ||
| else: | ||
| pass # prompt = sys.ps1 |
There was a problem hiding this comment.
Function Console.interact refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if) - Remove redundant pass statement (
remove-redundant-pass)
This removes the following comments ( why? ):
# prompt = sys.ps1
# prompt = sys.ps2
| if redirect: | ||
| sys.stdin = self.reader | ||
| else: | ||
| sys.stdin = self.stdin | ||
| sys.stdin = self.reader if redirect else self.stdin |
There was a problem hiding this comment.
Function Shell.redirectStdin refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| if redirect: | ||
| sys.stdout = PseudoFileOut(self.writeOut) | ||
| else: | ||
| sys.stdout = self.stdout | ||
| sys.stdout = PseudoFileOut(self.writeOut) if redirect else self.stdout |
There was a problem hiding this comment.
Function Shell.redirectStdout refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| if redirect: | ||
| sys.stderr = PseudoFileErr(self.writeErr) | ||
| else: | ||
| sys.stderr = self.stderr | ||
| sys.stderr = PseudoFileErr(self.writeErr) if redirect else self.stderr |
There was a problem hiding this comment.
Function Shell.redirectStderr refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| if self.GetSelectionStart() != self.GetSelectionEnd() \ | ||
| and self.GetSelectionStart() >= self.promptPosEnd \ | ||
| and self.GetSelectionEnd() >= self.promptPosEnd: | ||
| return True | ||
| else: | ||
| return False | ||
| return ( | ||
| self.GetSelectionStart() != self.GetSelectionEnd() | ||
| and self.GetSelectionStart() >= self.promptPosEnd | ||
| and self.GetSelectionEnd() >= self.promptPosEnd | ||
| ) |
There was a problem hiding this comment.
Function Shell.CanCut refactored with the following changes:
- Simplify boolean if expression (
boolean-if-exp-identity) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast) - Replace if statement with if expression (
assign-if-exp)
| if self.CanEdit() and editwindow.EditWindow.CanPaste(self): | ||
| return True | ||
| else: | ||
| return False | ||
| return bool(self.CanEdit() and editwindow.EditWindow.CanPaste(self)) |
There was a problem hiding this comment.
Function Shell.CanPaste refactored with the following changes:
- Simplify boolean if expression (
boolean-if-exp-identity) - Replace if statement with if expression (
assign-if-exp)
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!