Sourcery Starbot ⭐ refactored enthyp/chat#15
Sourcery Starbot ⭐ refactored enthyp/chat#15SourceryAI wants to merge 1 commit intoenthyp:masterfrom
Conversation
| else: | ||
| log.err('DB: password_correct CALL FAILURE: no such user in database') | ||
| raise failure.Failure(sqlite3.IntegrityError()) | ||
| log.err('DB: password_correct CALL FAILURE: no such user in database') | ||
| raise failure.Failure(sqlite3.IntegrityError()) |
There was a problem hiding this comment.
Function DBService.password_correct refactored with the following changes:
- Remove unnecessary else after guard condition (
remove-unnecessary-else)
| results = yield self._dbpool.runQuery(query.select_notifications, (user,)) | ||
| return results | ||
| return (yield self._dbpool.runQuery(query.select_notifications, (user,))) |
There was a problem hiding this comment.
Function DBService.get_notifications refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| for k, v in self.user2peer.items(): | ||
| if v == peer: | ||
| nicks.append(k) | ||
| nicks = [k for k, v in self.user2peer.items() if v == peer] |
There was a problem hiding this comment.
Function Dispatcher.remove_peer refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension)
| else: | ||
| if self.connected: | ||
| self.endpoint.no_channel(channel_name) | ||
| pass |
There was a problem hiding this comment.
Function LoggedInState.msg_JOIN refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
| if message.strip(" ") != "": | ||
| if self.client: | ||
| self.client.handle_input(message.strip(" ")) | ||
| if message.strip(" ") != "" and self.client: | ||
| self.client.handle_input(message.strip(" ")) |
There was a problem hiding this comment.
Function GUI.send_message refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs)
| """Connects to the specific database.""" | ||
| conn = sqlite3.connect(app.config['DATABASE']) | ||
| return conn | ||
| return sqlite3.connect(app.config['DATABASE']) |
There was a problem hiding this comment.
Function connect_db refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| # extracts all channels from records and returns list | ||
| def extract_channels(rows): | ||
| return list(set([row[1] for row in rows])) | ||
| return list({row[1] for row in rows}) |
There was a problem hiding this comment.
Function extract_channels refactored with the following changes:
- Replace unneeded comprehension with generator (
comprehension-to-generator) - Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension)
| for i in range(0, len(ratings_list)): | ||
| for j in range(0, 6): | ||
| for i in range(len(ratings_list)): | ||
| for j in range(6): |
There was a problem hiding this comment.
Function history refactored with the following changes:
- Replace range(0, x) with range(x) (
remove-zero-from-range)
| for i in range(0, len(ratings_list)): | ||
| for j in range(0, 6): | ||
| for i in range(len(ratings_list)): | ||
| for j in range(6): |
There was a problem hiding this comment.
Function channel refactored with the following changes:
- Replace range(0, x) with range(x) (
remove-zero-from-range)
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: