Sourcery refactored master branch - #2
Conversation
| def get_my_passwords(passbolt_obj): | ||
| result = list() | ||
| result = [] |
There was a problem hiding this comment.
Function get_my_passwords refactored with the following changes:
- Replace
list()with[](list-literal) - Replace call to format with f-string (
use-fstring-for-formatting)
| result = list() | ||
| result = [] |
There was a problem hiding this comment.
Function get_passwords_basic refactored with the following changes:
- Replace
list()with[](list-literal) - Replace call to format with f-string (
use-fstring-for-formatting)
| if return_response_object: | ||
| return r | ||
| return r.json() | ||
| return r if return_response_object else r.json() |
There was a problem hiding this comment.
Function APIClient.get 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)
| if return_response_object: | ||
| return r | ||
| return r.json() | ||
| return r if return_response_object else r.json() |
There was a problem hiding this comment.
Function APIClient.put 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)
| if return_response_object: | ||
| return r | ||
| return r.json() | ||
| return r if return_response_object else r.json() |
There was a problem hiding this comment.
Function APIClient.post 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)
| url_params = "?" + url_params | ||
| response = self.get("/resources.json" + url_params) | ||
| url_params = f"?{url_params}" | ||
| response = self.get(f"/resources.json{url_params}") | ||
| assert "body" in response.keys(), f"Key 'body' not found in response keys: {response.keys()}" | ||
| resources = response["body"] | ||
| for resource in resources: | ||
| yield resource | ||
| yield from response["body"] |
There was a problem hiding this comment.
Function PassboltAPI.iterate_resources refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation) - Inline variable that is immediately yielded (
inline-immediately-yielded-variable) - Replace yield inside for loop with yield from (
yield-from)
| url_params = "?" + url_params | ||
| response = self.get("/folders.json" + url_params) | ||
| url_params = f"?{url_params}" | ||
| response = self.get(f"/folders.json{url_params}") |
There was a problem hiding this comment.
Function PassboltAPI.list_resources refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| response = self.get(f"/users.json", params=params) | ||
| response = self.get("/users.json", params=params) |
There was a problem hiding this comment.
Function PassboltAPI.list_users refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring)
| r = self.put(f"/resources/{resource_id}.json", payload, return_response_object=True) | ||
| return r | ||
| return self.put( | ||
| f"/resources/{resource_id}.json", | ||
| payload, | ||
| return_response_object=True, | ||
| ) |
There was a problem hiding this comment.
Function PassboltAPI.update_resource refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
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!