Sourcery refactored master branch#1
Conversation
| """ | ||
| @classmethod | ||
| def debug(*args, **kwargs): | ||
| def debug(cls, **kwargs): |
There was a problem hiding this comment.
Function LOG.debug refactored with the following changes:
- The first argument to class methods should be
cls(class-method-first-arg-name)
|
|
||
| @classmethod | ||
| def info(*args, **kwargs): | ||
| def info(cls, **kwargs): |
There was a problem hiding this comment.
Function LOG.info refactored with the following changes:
- The first argument to class methods should be
cls(class-method-first-arg-name)
|
|
||
| @classmethod | ||
| def warning(*args, **kwargs): | ||
| def warning(cls, **kwargs): |
There was a problem hiding this comment.
Function LOG.warning refactored with the following changes:
- The first argument to class methods should be
cls(class-method-first-arg-name)
|
|
||
| @classmethod | ||
| def error(*args, **kwargs): | ||
| def error(cls, **kwargs): |
There was a problem hiding this comment.
Function LOG.error refactored with the following changes:
- The first argument to class methods should be
cls(class-method-first-arg-name)
|
|
||
| @classmethod | ||
| def critical(*args, **kwargs): | ||
| def critical(cls, **kwargs): |
There was a problem hiding this comment.
Function LOG.critical refactored with the following changes:
- The first argument to class methods should be
cls(class-method-first-arg-name)
| """ | ||
| sector = self.current_sector_data | ||
| for dummy in range(8): | ||
| for _ in range(8): |
There was a problem hiding this comment.
Function Disk._harvest_entries refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore) - Replace boolean ternary with inline if expression (
ternary-to-if-expression) - Replace if statement with if expression (
assign-if-exp)
| return self._show_error() | ||
|
|
||
| return 0 | ||
| return self._show_error() if not self._call_command('delete', dst=dst) else 0 |
There was a problem hiding this comment.
Function Uc1541.rm 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)
| perms = "-r%s-r--r--" % (rw.strip() and "-" or "w") | ||
| perms = f'-r{rw.strip() and "-" or "w"}-r--r--' |
There was a problem hiding this comment.
Function Uc1541._get_dir refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| if self._verbose: | ||
| return self.err | ||
| else: | ||
| return 1 | ||
| return self.err if self._verbose else 1 |
There was a problem hiding this comment.
Function Uc1541._show_error refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| command = ['c1541', '-attach', self.arch, '-%s' % cmd] | ||
| command = ['c1541', '-attach', self.arch, f'-{cmd}'] | ||
| if src: | ||
| command.append(src) | ||
| if dst: | ||
| command.append(dst) | ||
|
|
||
| LOG.debug('executing command: %s', ' '.join(command)) | ||
| # For some reason using write and delete commands and reading output | ||
| # confuses Python3 beneath MC and as a consequence MC report an | ||
| # error...therefore for those commands let's not use | ||
| # universal_newlines... | ||
| universal_newlines = True | ||
| if cmd in ['delete', 'write']: | ||
| universal_newlines = False | ||
| universal_newlines = cmd not in ['delete', 'write'] |
There was a problem hiding this comment.
Function Uc1541._call_command refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Simplify boolean if expression (
boolean-if-exp-identity) - Replace if statement with if expression (
assign-if-exp) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast)
This removes the following comments ( why? ):
# universal_newlines...
# error...therefore for those commands let's not use
# confuses Python3 beneath MC and as a consequence MC report an
# For some reason using write and delete commands and reading output
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!