Conversation
| if ';' in line: | ||
| requirement, _, specifier = line.partition(';') | ||
| for_specifier = EXTRAS.setdefault(':{}'.format(specifier), []) | ||
| for_specifier = EXTRAS.setdefault(f':{specifier}', []) |
There was a problem hiding this comment.
Lines 40-68 refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| htmlhelp_basename = '%sdoc' % project | ||
| htmlhelp_basename = f'{project}doc' | ||
|
|
||
| # Grouping the document tree into LaTeX files. List of tuples | ||
| # (source start file, target name, title, author, documentclass | ||
| # [howto/manual]). | ||
| latex_documents = [ | ||
| ('index', | ||
| '%s.tex' % project, | ||
| u'%s Documentation' % project, | ||
| u'Kubernetes', 'manual'), | ||
| ( | ||
| 'index', | ||
| f'{project}.tex', | ||
| f'{project} Documentation', | ||
| u'Kubernetes', | ||
| 'manual', | ||
| ) |
There was a problem hiding this comment.
Lines 84-93 refactored with the following changes:
- Replace interpolated string formatting with f-string [×3] (
replace-interpolation-with-fstring)
| resp = k8s_apps_v1.create_namespaced_deployment( | ||
| body=dep, namespace="default") | ||
| print("Deployment created. status='%s'" % resp.metadata.name) | ||
| print(f"Deployment created. status='{resp.metadata.name}'") |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| # Instantiate the deployment object | ||
| deployment = client.V1Deployment( | ||
| return client.V1Deployment( | ||
| api_version="apps/v1", | ||
| kind="Deployment", | ||
| metadata=client.V1ObjectMeta(name=DEPLOYMENT_NAME), | ||
| spec=spec) | ||
|
|
||
| return deployment | ||
| spec=spec, | ||
| ) |
There was a problem hiding this comment.
Function create_deployment_object refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# Instantiate the deployment object
| print("Deployment created. status='%s'" % str(api_response.status)) | ||
| print(f"Deployment created. status='{str(api_response.status)}'") |
There was a problem hiding this comment.
Function create_deployment refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
| # configuration.ssl_ca_cert="certificate" | ||
|
|
||
| aConfiguration.api_key = {"authorization": "Bearer " + aToken} | ||
| aConfiguration.api_key = {"authorization": f"Bearer {aToken}"} |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| sub_kls = re.match(r'list\[(.*)\]', klass).group(1) | ||
| sub_kls = re.match(r'list\[(.*)\]', klass)[1] | ||
| return [self.__deserialize(sub_data, sub_kls) | ||
| for sub_data in data] | ||
|
|
||
| if klass.startswith('dict('): | ||
| sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) | ||
| sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass)[2] |
There was a problem hiding this comment.
Function ApiClient.__deserialize refactored with the following changes:
- Replace m.group(x) with m[x] for re.Match objects [×2] (
use-getitem-for-re-match-groups)
| if post_params: | ||
| params = post_params | ||
|
|
||
| params = post_params or [] |
There was a problem hiding this comment.
Function ApiClient.prepare_post_parameters refactored with the following changes:
- Move setting of default value for variable into
elsebranch (introduce-default-else) - Unwrap a constant iterable constructor [×2] (
unwrap-iterable-construction) - Simplify if expression by using or (
or-if-exp-identity) - Replace if statement with if expression (
assign-if-exp)
| auth_setting = self.configuration.auth_settings().get(auth) | ||
| if auth_setting: | ||
| if auth_setting := self.configuration.auth_settings().get(auth): |
There was a problem hiding this comment.
Function ApiClient.update_params_for_auth refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| content_disposition = response.getheader("Content-Disposition") | ||
| if content_disposition: | ||
| filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', | ||
| content_disposition).group(1) | ||
| if content_disposition := response.getheader("Content-Disposition"): | ||
| filename = re.search( | ||
| r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition | ||
| )[1] |
There was a problem hiding this comment.
Function ApiClient.__deserialize_file refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Replace m.group(x) with m[x] for re.Match objects (
use-getitem-for-re-match-groups)
| klass_name = instance.get_real_child_model(data) | ||
| if klass_name: | ||
| if klass_name := instance.get_real_child_model(data): |
There was a problem hiding this comment.
Function ApiClient.__deserialize_model refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| def __init__(cls, name, bases, dct): | ||
| super(TypeWithDefault, cls).__init__(name, bases, dct) | ||
| cls._default = None | ||
| def __init__(self, name, bases, dct): | ||
| super(TypeWithDefault, self).__init__(name, bases, dct) | ||
| self._default = None |
There was a problem hiding this comment.
Function TypeWithDefault.__init__ refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name)
| def __call__(cls): | ||
| if cls._default is None: | ||
| cls._default = type.__call__(cls) | ||
| return copy.copy(cls._default) | ||
| def __call__(self): | ||
| if self._default is None: | ||
| self._default = type.__call__(self) | ||
| return copy.copy(self._default) |
There was a problem hiding this comment.
Function TypeWithDefault.__call__ refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name)
| def set_default(cls, default): | ||
| cls._default = copy.copy(default) | ||
| def set_default(self, default): | ||
| self._default = copy.copy(default) |
There was a problem hiding this comment.
Function TypeWithDefault.set_default refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name)
| # Logging Settings | ||
| self.logger = {} | ||
| self.logger["package_logger"] = logging.getLogger("client") | ||
| self.logger = {"package_logger": logging.getLogger("client")} |
There was a problem hiding this comment.
Function Configuration.__init__ refactored with the following changes:
- Merge dictionary assignment with declaration (
merge-dict-assign)
| collection_formats=collection_formats) | ||
|
|
||
| def delete_collection_mutating_webhook_configuration(self, **kwargs): # noqa: E501 | ||
| def delete_collection_mutating_webhook_configuration(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_collection_mutating_webhook_configuration refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def delete_collection_mutating_webhook_configuration_with_http_info(self, **kwargs): # noqa: E501 | ||
| def delete_collection_mutating_webhook_configuration_with_http_info(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_collection_mutating_webhook_configuration_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Move assignment closer to its usage within a block (
move-assign-in-block) - Merge dictionary assignment with declaration (
merge-dict-assign) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Simplify dictionary access using default get (
default-get) - Replace if statement with if expression (
assign-if-exp) - Replace
dict.get(x, None)withdict.get(x)(remove-none-from-default-get)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def delete_collection_validating_webhook_configuration(self, **kwargs): # noqa: E501 | ||
| def delete_collection_validating_webhook_configuration(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_collection_validating_webhook_configuration refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def delete_collection_validating_webhook_configuration_with_http_info(self, **kwargs): # noqa: E501 | ||
| def delete_collection_validating_webhook_configuration_with_http_info(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_collection_validating_webhook_configuration_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Move assignment closer to its usage within a block (
move-assign-in-block) - Merge dictionary assignment with declaration (
merge-dict-assign) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Simplify dictionary access using default get (
default-get) - Replace if statement with if expression (
assign-if-exp) - Replace
dict.get(x, None)withdict.get(x)(remove-none-from-default-get)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def delete_mutating_webhook_configuration(self, name, **kwargs): # noqa: E501 | ||
| def delete_mutating_webhook_configuration(self, name, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_mutating_webhook_configuration refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def delete_mutating_webhook_configuration_with_http_info(self, name, **kwargs): # noqa: E501 | ||
| def delete_mutating_webhook_configuration_with_http_info(self, name, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_mutating_webhook_configuration_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Merge dictionary assignment with declaration [×2] (
merge-dict-assign) - Remove redundant conditional (
remove-redundant-if) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Move assignment closer to its usage within a block (
move-assign-in-block) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Simplify dictionary access using default get (
default-get) - Replace if statement with if expression (
assign-if-exp) - Replace
dict.get(x, None)withdict.get(x)(remove-none-from-default-get)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def delete_validating_webhook_configuration(self, name, **kwargs): # noqa: E501 | ||
| def delete_validating_webhook_configuration(self, name, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_validating_webhook_configuration refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def delete_validating_webhook_configuration_with_http_info(self, name, **kwargs): # noqa: E501 | ||
| def delete_validating_webhook_configuration_with_http_info(self, name, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.delete_validating_webhook_configuration_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Merge dictionary assignment with declaration [×2] (
merge-dict-assign) - Remove redundant conditional (
remove-redundant-if) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Move assignment closer to its usage within a block (
move-assign-in-block) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Simplify dictionary access using default get (
default-get) - Replace if statement with if expression (
assign-if-exp) - Replace
dict.get(x, None)withdict.get(x)(remove-none-from-default-get)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def get_api_resources(self, **kwargs): # noqa: E501 | ||
| def get_api_resources(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.get_api_resources refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def get_api_resources_with_http_info(self, **kwargs): # noqa: E501 | ||
| def get_api_resources_with_http_info(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function AdmissionregistrationV1beta1Api.get_api_resources_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Move assignment closer to its usage within a block [×2] (
move-assign-in-block) - Merge dictionary assignment with declaration (
merge-dict-assign) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def delete_custom_resource_definition_with_http_info(self, name, **kwargs): # noqa: E501 | ||
| def delete_custom_resource_definition_with_http_info(self, name, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function ApiextensionsV1beta1Api.delete_custom_resource_definition_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Merge dictionary assignment with declaration [×2] (
merge-dict-assign) - Remove redundant conditional (
remove-redundant-if) - Move setting of default value for variable into
elsebranch (introduce-default-else) - Move assignment closer to its usage within a block (
move-assign-in-block) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring) - Simplify dictionary access using default get (
default-get) - Replace if statement with if expression (
assign-if-exp) - Replace
dict.get(x, None)withdict.get(x)(remove-none-from-default-get)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def get_api_resources(self, **kwargs): # noqa: E501 | ||
| def get_api_resources(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function ApiextensionsV1beta1Api.get_api_resources refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def get_api_resources_with_http_info(self, **kwargs): # noqa: E501 | ||
| def get_api_resources_with_http_info(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function ApiextensionsV1beta1Api.get_api_resources_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Move assignment closer to its usage within a block [×2] (
move-assign-in-block) - Merge dictionary assignment with declaration (
merge-dict-assign) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
| def list_custom_resource_definition(self, **kwargs): # noqa: E501 | ||
| def list_custom_resource_definition(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function ApiextensionsV1beta1Api.list_custom_resource_definition refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def list_custom_resource_definition_with_http_info(self, **kwargs): # noqa: E501 | ||
| def list_custom_resource_definition_with_http_info(self, **kwargs): # noqa: E501 |
There was a problem hiding this comment.
Function ApiextensionsV1beta1Api.list_custom_resource_definition_with_http_info refactored with the following changes:
- Merge append into list declaration [×4] (
merge-list-append) - Move assignment closer to its usage within a block [×2] (
move-assign-in-block) - Merge dictionary assignment with declaration (
merge-dict-assign) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
This removes the following comments ( why? ):
# noqa: E501
# HTTP header `Accept`
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.04%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
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!