-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery Starbot ⭐ refactored marks/python-slackclient #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?
Conversation
| system_info = "{0}/{1}".format(platform.system(), platform.release()) | ||
| user_agent_string = " ".join([python_version, client, system_info]) | ||
| return user_agent_string | ||
| return " ".join([python_version, client, system_info]) |
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 BaseClient._get_user_agent refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| present = ( | ||
| return ( | ||
| "response_metadata" in data | ||
| and "next_cursor" in data["response_metadata"] | ||
| and data["response_metadata"]["next_cursor"] != "" | ||
| ) | ||
| return present |
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 SlackResponse._next_cursor_is_present refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| if self.data_source == "external": | ||
| if isinstance(self.value, Option): | ||
| if isinstance(self.value, Option): | ||
| if self.data_source == "external": | ||
| json["selected_options"] = extract_json([self.value], "dialog") | ||
| elif self.value is not None: | ||
| json["selected_options"] = Option.from_single_value(self.value) | ||
| else: | ||
| if isinstance(self.value, Option): | ||
| else: | ||
| json["value"] = self.value.value | ||
| elif self.value is not None: | ||
| json["value"] = self.value | ||
| elif self.value is not None: | ||
| json["selected_options"] = Option.from_single_value(self.value) |
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 AbstractDialogSelector.to_dict refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if)
| self._state = dumps(state) | ||
| else: | ||
| self._state = state | ||
| self._state = dumps(state) if isinstance(state, dict) else state |
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 DialogBuilder.state refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
| self.state = json.loads(event["state"]) | ||
| else: | ||
| self.state = {} | ||
| self.state = json.loads(event["state"]) if event["state"] else {} |
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 DialogInteractiveEvent.__init__ refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
|
|
||
| def fake_req_args(headers=ANY, data=ANY, params=ANY, json=ANY): | ||
| req_args = { | ||
| return { |
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 fake_req_args refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| req_args = { | ||
| return { |
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 fake_send_req_args refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| else: | ||
| self.assertEqual(rtm_client._connection_attempts, 2) | ||
| rtm_client.stop() | ||
| self.assertEqual(rtm_client._connection_attempts, 2) | ||
| rtm_client.stop() |
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 TestRTMClientFunctional.test_client_auto_reconnects_if_an_error_is_thrown.stop_on_open refactored with the following changes:
- Remove unnecessary else after guard condition (
remove-unnecessary-else)
| users = [] | ||
| for page in self.client.users_list(limit=2): | ||
| users = users + page["members"] | ||
| users += page["members"] |
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 TestWebClient.test_requests_can_be_paginated refactored with the following changes:
- Replace assignment with augmented assignment (
aug-assign)
| users = [] | ||
| for page in self.client.users_list(limit=2): | ||
| users = users + page["members"] | ||
| users += page["members"] |
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 TestWebClient.test_request_pagination_stops_when_next_cursor_is_missing refactored with the following changes:
- Replace assignment with augmented assignment (
aug-assign)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run: