-
Notifications
You must be signed in to change notification settings - Fork 0
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
| print("Found " + str(len(results)) + " Results.") | ||
| print(f"Found {len(results)} Results.") | ||
|
|
||
| for i in results: | ||
| string = "" | ||
| for j in i: | ||
| string += j | ||
| string = "".join(i) |
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.
Lines 12-17 refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation) - Use str.join() instead of for loop (
use-join) - Remove unnecessary calls to
str()from formatted values in f-strings (remove-str-from-fstring) - Simplify generator expression (
simplify-generator)
| titlePrinter() | ||
| check = rootcheck() | ||
| masterList = [] | ||
| blacklist = ('http://76qugh5bey5gum7l.onion') |
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.
Lines 24-24 refactored with the following changes:
- Hoist statements out of for/while loops (
hoist-statement-from-loop)
| html = str(content,'utf-8').replace('\t',' ').replace('\n',' ').replace('\r',' ').replace('\"','') | ||
| return html | ||
| return ( | ||
| str(content, 'utf-8') | ||
| .replace('\t', ' ') | ||
| .replace('\n', ' ') | ||
| .replace('\r', ' ') | ||
| .replace('\"', '') | ||
| ) |
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 onionHTML refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| ahmia = list(set(results)) | ||
| return ahmia | ||
| return list(set(results)) |
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 ahmia refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| results = [] | ||
| regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" |
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 redditOnions refactored with the following changes:
- Move assignments closer to their usage (
move-assign) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| for i in onions: | ||
| temp.append((i.replace("<a href=","").replace(">",""))) | ||
| temp.extend(i.replace("<a href=","").replace(">","") for i in onions) | ||
| for i in temp: | ||
| if "http" in i: | ||
| if ".onion" not in i: | ||
| pass | ||
| else: | ||
| if ".onion" in i: | ||
| temp2.append(i) | ||
| elif "mailto:" in i: | ||
| pass | ||
| elif i.startswith("../"): | ||
| i = i.replace("../",inputURL+"/") | ||
| i = i.replace("../", f"{inputURL}/") | ||
| temp2.append(i) | ||
| elif i.startswith("/"): | ||
| temp2.append(inputURL+i) | ||
| else: | ||
| temp2.append(inputURL + "/" + i) | ||
| aTag = list(set(temp2)) | ||
| return aTag | ||
| temp2.append(f"{inputURL}/{i}") | ||
| return list(set(temp2)) |
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 aTag refactored with the following changes:
- Swap if/else to remove empty if body (
remove-pass-body) - Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation) - Inline variable that is immediately returned (
inline-immediately-returned-variable) - Replace a for append loop with list extend (
for-append-to-extend)
| def createDB(): | ||
| con = sqlite3.connect('output/deepminer.db') | ||
| return con | ||
| return sqlite3.connect('output/deepminer.db') |
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 createDB refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| con = sqlite3.connect('output/deepminer.db', timeout=30) | ||
| return con | ||
| return sqlite3.connect('output/deepminer.db', timeout=30) |
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 connectDB refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| results = cur.fetchall() | ||
| return results | ||
| return cur.fetchall() |
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 searchDB refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| results = cur.fetchall() | ||
| return results | ||
| return cur.fetchall() |
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 searchFTS refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
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!