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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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!