Skip to content

Commit 80457b5

Browse files
authored
Merge pull request DedSecInside#266 from DedSecInside/enhance_configuration
Adding flake8 fixes
2 parents ded56e7 + 25b5bff commit 80457b5

File tree

12 files changed

+24
-28
lines changed

12 files changed

+24
-28
lines changed

run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
torbot = main.TorBot(args)
88
torbot.perform_action()
99
except KeyboardInterrupt:
10-
print("Interrupt received! Exiting cleanly...")
10+
print("Interrupt received! Exiting cleanly...")

torbot/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@
1010
from .modules.collect_data import collect_data
1111

1212
from . import version
13-
14-
15-

torbot/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
torbot = main.TorBot(args)
88
torbot.perform_action()
99
except KeyboardInterrupt:
10-
print("Interrupt received! Exiting cleanly...")
10+
print("Interrupt received! Exiting cleanly...")

torbot/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
import argparse
55
import sys
6-
import os
76

87
from .modules import link_io
98
from .modules.linktree import LinkTree

torbot/modules/collect_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def collect_data(user_url: str):
5656
with open(file_path, 'w+') as outcsv:
5757
fieldnames = ['ID', 'Title', 'Metadata', 'Content']
5858
writer = SafeDictWriter(outcsv, fieldnames=fieldnames)
59-
bar = Bar(f'Processing...', max=len(links))
59+
bar = Bar('Processing...', max=len(links))
6060
for link in links:
6161
resp = requests.get(link)
6262
soup = BeautifulSoup(resp.text, 'html.parser')

torbot/modules/config.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
log_level_str = os.getenv("LOG_LEVEL").lower() if os.getenv("LOG_LEVEL") else "info"
1313
LOG_LEVELS = {
14-
"info": logging.INFO,
15-
"error": logging.ERROR,
16-
"debug": logging.DEBUG,
17-
"warning": logging.WARNING,
14+
"info": logging.INFO,
15+
"error": logging.ERROR,
16+
"debug": logging.DEBUG,
17+
"warning": logging.WARNING,
1818
}
1919

20+
2021
def get_log_level():
21-
for str_input, log_level in LOG_LEVELS.items():
22-
if log_level_str == str_input:
23-
return log_level
22+
for str_input, log_level in LOG_LEVELS.items():
23+
if log_level_str == str_input:
24+
return log_level

torbot/modules/link_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def cascade(node: LinkTree, work: Any, classify_page: bool):
5353
cascade(child, work, classify_page)
5454

5555

56-
def print_tree(url: str, depth: int=1, classify_page: bool=False):
56+
def print_tree(url: str, depth: int = 1, classify_page: bool = False):
5757
"""
5858
Prints the entire tree in a user friendly fashion
5959
"""
6060
root = get_node(url, depth)
6161
cascade(root, print_node, classify_page)
6262

6363

64-
def print_json(url: str, depth: int=1):
64+
def print_json(url: str, depth: int = 1):
6565
"""
6666
Prints the JSON representation of a Link node.
6767

torbot/modules/linktree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __append_node(self, parent_tree, node):
3030
for child in node['children']:
3131
self.__append_node(child_tree, child)
3232

33-
def __build_tree(self, url: str, depth: int=1):
33+
def __build_tree(self, url: str, depth: int = 1):
3434
"""
3535
Builds link tree by traversing through children nodes.
3636

torbot/modules/log.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
from .config import get_log_level
44

55

6-
logging.basicConfig(level=get_log_level(), format='%(asctime)s - %(levelname)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
6+
logging.basicConfig(level=get_log_level(),
7+
format='%(asctime)s - %(levelname)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
8+
79

810
def info(msg: str):
9-
logging.info(msg)
11+
logging.info(msg)
12+
1013

1114
def fatal(msg: str):
12-
logging.error(msg)
15+
logging.error(msg)
16+
1317

1418
def debug(msg: str):
15-
logging.debug(msg)
19+
logging.debug(msg)

torbot/modules/nlp/main.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import requests
21
import numpy as np
32
import os
43
from pathlib import Path
@@ -35,10 +34,6 @@ def classify(data):
3534
x_train, x_test, y_train, y_test = train_test_split(dataset.data, dataset.target)
3635
clf.fit(x_train, y_train)
3736

38-
website = 'Unknown'
39-
if soup.title:
40-
website = soup.title.text
41-
4237
# returns an array of target_name values
4338
predicted = clf.predict([html])
4439
accuracy = np.mean(predicted == y_test)

torbot/modules/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def find_file(name: str, path: str):
2020
return False
2121

2222

23-
def join_local_path(file_name: str=""):
23+
def join_local_path(file_name: str = ""):
2424
"""
2525
Returns:
2626
str: local path to data directory

torbot/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.1.0'
1+
__version__ = '2.1.0'

0 commit comments

Comments
 (0)