-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery refactored main 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: main
Are you sure you want to change the base?
Conversation
| uuid = res[0]['uuid'] | ||
|
|
||
| return uuid | ||
| return res[0]['uuid'] |
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 Client.get_organization_id refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| attachment_response = self.upload_attachment(attachment) | ||
| if attachment_response: | ||
| if attachment_response := self.upload_attachment(attachment): |
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 Client.send_message refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# Returns answer
| if response.status_code == 204: | ||
| return True | ||
| else: | ||
| return False | ||
| return response.status_code == 204 |
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 Client.delete_conversation refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify boolean if expression (
boolean-if-exp-identity) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast)
| formatted_uuid = f"{random_uuid_str[0:8]}-{random_uuid_str[9:13]}-{random_uuid_str[14:18]}-{random_uuid_str[19:23]}-{random_uuid_str[24:]}" | ||
| return formatted_uuid | ||
| return f"{random_uuid_str[:8]}-{random_uuid_str[9:13]}-{random_uuid_str[14:18]}-{random_uuid_str[19:23]}-{random_uuid_str[24:]}" |
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 Client.generate_uuid refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable) - Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index)
| if response.status_code == 200: | ||
| return response.json() | ||
| else: | ||
| return False | ||
| return response.json() if response.status_code == 200 else False |
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 Client.upload_attachment refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| if response.status_code == 200: | ||
| return True | ||
| else: | ||
| return False | ||
| return response.status_code == 200 |
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 Client.rename_chat refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Simplify boolean if expression (
boolean-if-exp-identity) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast)
| cookie = os.environ.get('cookie') | ||
| if not cookie: | ||
| if cookie := os.environ.get('cookie'): | ||
| return cookie | ||
| else: | ||
| raise ValueError("Please set the 'cookie' environment variable.") | ||
| return cookie |
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 get_cookie refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Lift code into else after jump in control flow (
reintroduce-else) - Swap if/else branches (
swap-if-else-branches)
Branch
mainrefactored 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
mainbranch, then run:Help us improve this pull request!