-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,23 +32,23 @@ else: | |
| Dummy logger object. Does nothing. | ||
| """ | ||
| @classmethod | ||
| def debug(*args, **kwargs): | ||
| def debug(cls, **kwargs): | ||
| pass | ||
|
|
||
| @classmethod | ||
| def info(*args, **kwargs): | ||
| def info(cls, **kwargs): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| pass | ||
|
|
||
| @classmethod | ||
| def warning(*args, **kwargs): | ||
| def warning(cls, **kwargs): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| pass | ||
|
|
||
| @classmethod | ||
| def error(*args, **kwargs): | ||
| def error(cls, **kwargs): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| pass | ||
|
|
||
| @classmethod | ||
| def critical(*args, **kwargs): | ||
| def critical(cls, **kwargs): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| pass | ||
|
|
||
|
|
||
|
|
@@ -157,7 +157,7 @@ class Disk(object): | |
| characters with jokers. | ||
| """ | ||
|
|
||
| filename = list() | ||
| filename = [] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| for chr_ in string: | ||
| if _ord(chr_) == 160: # shift+space character; $a0 | ||
|
|
@@ -237,7 +237,7 @@ class Disk(object): | |
| Traverse through sectors and store entries in _dir_contents | ||
| """ | ||
| sector = self.current_sector_data | ||
| for dummy in range(8): | ||
| for _ in range(8): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| entry = sector[:32] | ||
| ftype = _ord(entry[2]) | ||
|
|
||
|
|
@@ -247,13 +247,13 @@ class Disk(object): | |
|
|
||
| type_verbose = self._get_ftype(ftype) | ||
|
|
||
| protect = _ord(entry[2]) & 64 and "<" or " " | ||
| protect = "<" if _ord(entry[2]) & 64 else " " | ||
| fname = entry[5:21] | ||
| if ftype == 'rel': | ||
| size = _ord(entry[23]) | ||
| else: | ||
| size = _ord(entry[30]) + _ord(entry[31]) * 226 | ||
|
|
||
| size = ( | ||
| _ord(entry[23]) | ||
| if ftype == 'rel' | ||
| else _ord(entry[30]) + _ord(entry[31]) * 226 | ||
| ) | ||
| self._dir_contents.append({'fname': self._map_filename(fname), | ||
| 'ftype': type_verbose, | ||
| 'size': size, | ||
|
|
@@ -431,10 +431,7 @@ class Uc1541(object): | |
| LOG.info("Removing file %s", dst) | ||
| dst = self._get_masked_fname(dst) | ||
|
|
||
| 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 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| def copyin(self, dst, src): | ||
| """ | ||
|
|
@@ -551,7 +548,7 @@ class Uc1541(object): | |
| if ext == 'del': | ||
| perms = "----------" | ||
| else: | ||
| perms = "-r%s-r--r--" % (rw.strip() and "-" or "w") | ||
| perms = f'-r{rw.strip() and "-" or "w"}-r--r--' | ||
|
Comment on lines
-554
to
+551
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| directory.append({'pattern_name': pattern_name, | ||
| 'display_name': display_name, | ||
|
|
@@ -566,10 +563,7 @@ class Uc1541(object): | |
| """ | ||
| Pass out error output from c1541 execution | ||
| """ | ||
| if self._verbose: | ||
| return self.err | ||
| else: | ||
| return 1 | ||
| return self.err if self._verbose else 1 | ||
|
Comment on lines
-569
to
+566
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| def _call_command(self, cmd, src=None, dst=None): | ||
| """ | ||
|
|
@@ -579,20 +573,14 @@ class Uc1541(object): | |
| delete | ||
| dir/list | ||
| """ | ||
| 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'] | ||
|
Comment on lines
-582
to
+583
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ): |
||
| self.out, self.err = Popen(command, | ||
| universal_newlines=universal_newlines, | ||
| stdout=PIPE, stderr=PIPE).communicate() | ||
|
|
||
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.debugrefactored with the following changes:cls(class-method-first-arg-name)