Sourcery refactored main branch#1
Open
sourcery-ai[bot] wants to merge 1 commit into
Open
Conversation
Comment on lines
-24
to
+28
| if path.exists(self.pickle_path): # Ask if they intend to overwrite existing pickle | ||
| if input(f"overwrite {self.pickle_path}? (Y/N)\n").upper() != "Y": | ||
| self.pickle_path = self.pathify(self.gen_pickle_name()) | ||
| if ( | ||
| path.exists(self.pickle_path) | ||
| and input(f"overwrite {self.pickle_path}? (Y/N)\n").upper() != "Y" | ||
| ): | ||
| self.pickle_path = self.pathify(self.gen_pickle_name()) |
Author
There was a problem hiding this comment.
Function NgramModel.__init__ refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs)
This removes the following comments ( why? ):
# Ask if they intend to overwrite existing pickle
Comment on lines
-47
to
+52
| list_of_tup = [] | ||
|
|
||
| for i in range(len(words) + 1 - self.n): | ||
| list_of_tup.append((tuple(words[i + j] for j in range(self.n - 1)), words[i + self.n - 1])) | ||
|
|
||
| return list_of_tup | ||
| return [ | ||
| (tuple(words[i + j] for j in range(self.n - 1)), words[i + self.n - 1]) | ||
| for i in range(len(words) + 1 - self.n) | ||
| ] |
Author
There was a problem hiding this comment.
Function NgramModel.generate_Ngrams refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
|
|
||
| def calculate_freq(self, context: tuple): | ||
| freq = sum(freq for freq in self.context_options[context].values()) | ||
| freq = sum(self.context_options[context].values()) |
Author
There was a problem hiding this comment.
Function NgramModel.calculate_freq refactored with the following changes:
- Simplify generator expression (
simplify-generator)
Comment on lines
-33
to
+35
| pin = driver.find_element(By.CSS_SELECTOR, "kbd > code").get_attribute("innerText") | ||
| return pin | ||
| return driver.find_element(By.CSS_SELECTOR, "kbd > code").get_attribute( | ||
| "innerText" | ||
| ) |
Author
There was a problem hiding this comment.
Function get_pin refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| for i in signal.valid_signals(): | ||
| if (i == signal.SIGKILL or | ||
| i == signal.SIGSTOP): | ||
| if i in [signal.SIGKILL, signal.SIGSTOP]: |
Author
There was a problem hiding this comment.
Lines 57-58 refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| """ | ||
| search_param["query"] = keyword | ||
| to_return = dict() | ||
| to_return = {} |
Author
There was a problem hiding this comment.
Function Twitter.get_tweets refactored with the following changes:
- Replace
dict()with{}(dict-literal)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!