-
Notifications
You must be signed in to change notification settings - Fork 57
Sourcery Starbot ⭐ refactored Vinyzu/DiscordGenerator #102
base: main
Are you sure you want to change the base?
Conversation
| output += self.token + ":" | ||
| output += f"{self.token}:" | ||
| if "email" in item and self.email: | ||
| output += self.email + ":" | ||
| output += f"{self.email}:" | ||
| if "pass" in item: | ||
| output += self.browser.faker.password + ":" | ||
| output += f"{self.browser.faker.password}:" | ||
| if "proxy" in item and self.browser.proxy: | ||
| output += self.browser.proxy + ":" | ||
| output += f"{self.browser.proxy}:" |
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 Generator.log_output refactored with the following changes:
- Use f-string instead of string concatenation [×4] (
use-fstring-for-concatenation)
| await self.page.click("[class *= 'checkbox']", timeout=10000) | ||
| except Exception as e: | ||
| self.logger.debug("No TOS Checkbox was detected") | ||
| pass |
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 Generator.generate_unclaimed refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
This removes the following comments ( why? ):
# Catch Exceptions and save output anyways
| await tos_box.click() | ||
| except Exception as e: | ||
| self.logger.debug("No TOS Checkbox was detected") | ||
| pass |
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 Generator.generate_token refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
This removes the following comments ( why? ):
# Catch Exceptions and save output anyways
| email = True if email == "1" else False | ||
| email = email == "1" |
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 main refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Simplify boolean if expression [×2] (
boolean-if-exp-identity) - Remove unnecessary casts to int, str, float or bool [×2] (
remove-unnecessary-cast)
| super_props = base64.b64encode(str(super_props).encode()).decode() | ||
|
|
||
| headers = { | ||
| 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 Discord.get_headers refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def makeHTTPRequest(endpoint): | ||
| def makeHTTPRequest(self): | ||
| headers = { | ||
| "User-Agent": "TempMailPythonAPI/1.0", | ||
| "Accept": "application/json" | ||
| } | ||
| try: | ||
| connection = httpx.get(BASE_URL + endpoint, headers=headers) | ||
| connection = httpx.get(BASE_URL + self, headers=headers) | ||
| if connection.status_code >= 400: | ||
| raise Exception("HTTP Error: " + str(connection.status_code)) | ||
| raise Exception(f"HTTP Error: {str(connection.status_code)}") | ||
| except Exception as e: | ||
| print(e) | ||
| return None | ||
|
|
||
| response = connection.text | ||
|
|
||
| return response | ||
| return connection.text |
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 TempMail.makeHTTPRequest refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name) - Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def generateInbox(rush=False): | ||
| def generateInbox(self): | ||
| try: | ||
| random_domain = random.choice(DOMAINS) | ||
| s = TempMail.makeHTTPRequest(f"/generate/{random_domain}") | ||
| except: | ||
| print("Website responded with: " + s) | ||
| print(f"Website responded with: {s}") |
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 TempMail.generateInbox refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name) - Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| def getEmails(inbox): | ||
| s = TempMail.makeHTTPRequest("/auth/" + inbox.token) | ||
| def getEmails(self): | ||
| s = TempMail.makeHTTPRequest(f"/auth/{self.token}") |
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 TempMail.getEmails refactored with the following changes:
- The first argument to instance methods should be
self(instance-method-first-arg-name) - Use f-string instead of string concatenation (
use-fstring-for-concatenation) - Use x is None rather than x == None (
none-compare) - Convert for loop into list comprehension (
list-comprehension) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| return ("Email (sender={}, recipient={}, subject={}, body={}, html={}, date={} )" | ||
| .format(self.sender, self.recipient, self.subject, self.body, self.html, self.date)) | ||
| return f"Email (sender={self.sender}, recipient={self.recipient}, subject={self.subject}, body={self.body}, html={self.html}, date={self.date} )" |
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 Email.__repr__ refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| return ("Inbox (address={}, token={} )" | ||
| .format(self.address, self.token)) | ||
| return f"Inbox (address={self.address}, token={self.token} )" |
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 Inbox.__repr__ refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
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
mainbranch, then run: