-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
def debug(*args, **kwargs): | ||
def debug(cls, **kwargs): |
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 LOG.debug
refactored with the following changes:
- The first argument to class methods should be
cls
(class-method-first-arg-name
)
def info(*args, **kwargs): | ||
def info(cls, **kwargs): |
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 LOG.info
refactored with the following changes:
- The first argument to class methods should be
cls
(class-method-first-arg-name
)
def warning(*args, **kwargs): | ||
def warning(cls, **kwargs): |
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 LOG.warning
refactored with the following changes:
- The first argument to class methods should be
cls
(class-method-first-arg-name
)
def error(*args, **kwargs): | ||
def error(cls, **kwargs): |
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 LOG.error
refactored with the following changes:
- The first argument to class methods should be
cls
(class-method-first-arg-name
)
def critical(*args, **kwargs): | ||
def critical(cls, **kwargs): |
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 LOG.critical
refactored with the following changes:
- The first argument to class methods should be
cls
(class-method-first-arg-name
)
for dummy in range(8): | ||
for _ in range(8): |
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 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
)
if not self._call_command('delete', dst=dst): | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
else
branch (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
master
refactored 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
master
branch, then run:Help us improve this pull request!