Hanno Böck commited on 2021-09-05 09:46:29
Zeige 5 geänderte Dateien mit 11 Einfügungen und 9 Löschungen.
... | ... |
@@ -85,7 +85,7 @@ if not jdir: |
85 | 85 |
|
86 | 86 |
jconfig = [] |
87 | 87 |
for cfile in glob.glob(jdir + '/*.json'): |
88 |
- with open(cfile) as json_file: |
|
88 |
+ with open(cfile, encoding="ascii") as json_file: |
|
89 | 89 |
data = json.load(json_file) |
90 | 90 |
jconfig += data |
91 | 91 |
|
... | ... |
@@ -115,7 +115,8 @@ for fdir in opts.dirs: |
115 | 115 |
if filename == det['file']: |
116 | 116 |
mfile = os.path.join(root, filename) |
117 | 117 |
try: |
118 |
- file = open(mfile, errors='replace') |
|
118 |
+ file = open(mfile, encoding='ascii', |
|
119 |
+ errors='replace') |
|
119 | 120 |
except OSError: |
120 | 121 |
continue |
121 | 122 |
filestr = file.read(200000) |
... | ... |
@@ -146,7 +147,7 @@ for fdir in opts.dirs: |
146 | 147 |
+ int(det['add_minor'])) |
147 | 148 |
findversion = '.'.join(findversion) |
148 | 149 |
|
149 |
- if ((not versioncompare(item['safe'], findversion)) |
|
150 |
+ if (not versioncompare(item['safe'], findversion) |
|
150 | 151 |
or ('old_safe' in item |
151 | 152 |
and findversion in |
152 | 153 |
item['old_safe'].split(','))): |
... | ... |
@@ -4,7 +4,8 @@ import os |
4 | 4 |
import setuptools |
5 | 5 |
import setuptools.command.install |
6 | 6 |
|
7 |
-f = open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')) |
|
7 |
+f = open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md'), |
|
8 |
+ encoding="ascii") |
|
8 | 9 |
readme = f.read() |
9 | 10 |
f.close() |
10 | 11 |
|
... | ... |
@@ -33,7 +33,7 @@ class TestFreewvsData(unittest.TestCase): |
33 | 33 |
stdout=subprocess.PIPE, check=True) |
34 | 34 |
fwdata = re.sub(tmp, "[dir]", fwrun.stdout.decode("utf-8")) |
35 | 35 |
fwclean = re.sub(r' \(.* ', " ", fwdata) |
36 |
- f = open(tdir + "/refdata-a.txt") |
|
36 |
+ f = open(tdir + "/refdata-a.txt", encoding="ascii") |
|
37 | 37 |
refdata = f.read() |
38 | 38 |
f.close() |
39 | 39 |
refclean = re.sub(r' \(.* ', " ", refdata) |
... | ... |
@@ -19,7 +19,7 @@ class TestJsonLint(unittest.TestCase): |
19 | 19 |
def test_json_lint(self): |
20 | 20 |
valid = True |
21 | 21 |
for f in glob.glob("freewvsdb/*.json"): |
22 |
- fp = open(f) |
|
22 |
+ fp = open(f, encoding="ascii") |
|
23 | 23 |
orig = fp.read() |
24 | 24 |
fp.close() |
25 | 25 |
tmp = json.loads(orig) |
... | ... |
@@ -33,7 +33,7 @@ class TestJsonLint(unittest.TestCase): |
33 | 33 |
def test_json_values(self): |
34 | 34 |
jconfig = [] |
35 | 35 |
for cfile in glob.glob('freewvsdb/*.json'): |
36 |
- with open(cfile) as json_file: |
|
36 |
+ with open(cfile, encoding="ascii") as json_file: |
|
37 | 37 |
jconfig += json.load(json_file) |
38 | 38 |
|
39 | 39 |
mkeys = {'name', 'url', 'safe', 'vuln', 'detection'} |
... | ... |
@@ -27,7 +27,7 @@ if not target: |
27 | 27 |
|
28 | 28 |
old = 0 |
29 | 29 |
if os.path.isfile(target + "timestamp"): |
30 |
- with open(target + "timestamp") as f: |
|
30 |
+ with open(target + "timestamp", encoding="ascii") as f: |
|
31 | 31 |
old = int(f.read()) |
32 | 32 |
|
33 | 33 |
new = int(urllib.request.urlopen(DBURL + "freewvsdb.timestamp").read()) |
... | ... |
@@ -40,5 +40,5 @@ tarball = urllib.request.urlopen(DBURL + str(new) + ".tar.xz").read() |
40 | 40 |
|
41 | 41 |
tf = tarfile.open(fileobj=io.BytesIO(tarball)) |
42 | 42 |
tf.extractall(path=target) |
43 |
-with open(target + "timestamp", "w") as f: |
|
43 |
+with open(target + "timestamp", "w", encoding="ascii") as f: |
|
44 | 44 |
f.write(str(new)) |
45 | 45 |