Sourcery refactored dev branch#1
Conversation
| logger.info("Deleting file: " + self.file_name) | ||
| logger.info(f"Deleting file: {self.file_name}") | ||
| os.remove(self.file_name) | ||
| else: | ||
| logger.info("File does not exist: " + self.file_name) | ||
| logger.info(f"File does not exist: {self.file_name}") |
There was a problem hiding this comment.
Function FileCache.clear refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| def get_cache(name, max_age=DEFAULT_MAX_AGE, cache_dir=DEFAULT_CACHE_DIR): | ||
| file_name = os.path.join(cache_dir, name + '.json') | ||
| file_name = os.path.join(cache_dir, f'{name}.json') |
There was a problem hiding this comment.
Function get_cache refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| pass | ||
|
|
||
| raise ValueError('Failed to decode file {} - unknown decoding'.format(file_path)) | ||
| raise ValueError(f'Failed to decode file {file_path} - unknown decoding') |
There was a problem hiding this comment.
Function read_file_content refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| or (TRACE_ENV_VAR_COMPAT in os.environ and os.environ[TRACE_ENV_VAR_COMPAT] == 'true'): | ||
| print(request.method + ' ' + request.url) | ||
| or (TRACE_ENV_VAR_COMPAT in os.environ and os.environ[TRACE_ENV_VAR_COMPAT] == 'true'): | ||
| print(f'{request.method} {request.url}') |
There was a problem hiding this comment.
Function Client._send_request refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| headers = {'Content-Type': media_type + '; charset=utf-8', | ||
| 'Accept': accept_media_type + ';api-version=' + negotiated_version} | ||
| headers = { | ||
| 'Content-Type': f'{media_type}; charset=utf-8', | ||
| 'Accept': f'{accept_media_type};api-version={negotiated_version}', | ||
| } |
There was a problem hiding this comment.
Function Client._send refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_file refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_attachment refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_file_contents refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_build_log refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_build_logs_zip refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_build_log_zip refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function BuildClient.get_build_report_html_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function FeedClient.get_badge refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function GitClientBase.get_blob_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function GitClientBase.get_blobs_zip refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function NpmClient.get_readme_scoped_package refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function NpmClient.get_readme_unscoped_package refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function ReleaseClient.get_release_task_attachment_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function ReleaseClient.get_logs refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function ReleaseClient.get_task_log refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function ReleaseClient.get_release_revision refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function ReleaseClient.get_definition_revision refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TaskClient.create_attachment refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TaskClient.get_attachment_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TaskClient.append_log_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TfvcClient.get_item_content refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TfvcClient.get_item_text refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function TfvcClient.get_item_zip refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function WikiClient.create_attachment refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
| if "callback" in kwargs: | ||
| callback = kwargs["callback"] | ||
| else: | ||
| callback = None | ||
| callback = kwargs.get("callback", None) |
There was a problem hiding this comment.
Function WikiClient.get_page_text refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify dictionary access using default get (
default-get)
Branch
devrefactored 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
devbranch, then run:Help us improve this pull request!