-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskim_not_responding.py
executable file
·59 lines (45 loc) · 1.66 KB
/
skim_not_responding.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
from time import perf_counter
from typing import List
import skim_content_check
class SkimNotResponding:
'''
Read list of non-responding sites and re-test.
Test HTTPS
'''
def __init__(self):
self.perf_read_file: str = ""
self.perf_clean_list: str = ""
def read_file(self, filename: str) -> List:
p1 = perf_counter()
non_res_urls = []
apnd = non_res_urls.append
with open(str(filename), "r") as file:
[apnd(f) for f in file.readlines()]
p2 = perf_counter()
self.perf_read_file = str(round(p2 - p1, 6))
return non_res_urls
def clean_list(self, the_list: List) -> List:
p1 = perf_counter()
new_list = []
apnd = new_list.append
[apnd(el) for el in the_list]
p2 = perf_counter()
self.perf_clean_list = str(round(p2 - p1, 6))
return new_list
def main():
new_skim_not_res = SkimNotResponding()
check = skim_content_check.SkimContentCheck()
dirname = skim_content_check.SkimContentCheck().get_dir_name_cmd_builder("most_recent")
print("!!! Not Responding dirname: - " + str(dirname))
#TODO: cmd is wrong in contect check print
most_recent_dir = check.get_dir_name("ls " + dirname + "/*not_res*")
print("most recent: " + str(most_recent_dir))
file_off_disk = new_skim_not_res.read_file(most_recent_dir)
print("file off: " + str(file_off_disk))
clean_list = new_skim_not_res.clean_list(file_off_disk)
print(new_skim_not_res.perf_read_file)
print(new_skim_not_res.perf_clean_list)
x = [print(x) for x in clean_list]
if __name__ == '__main__':
main()