Fix problems detected by pylint 2.8.1.

This commit is contained in:
Alexander Arlt 2021-04-25 23:33:14 -05:00
parent eed0bf580b
commit 4e7dc24383
5 changed files with 127 additions and 127 deletions

View File

@ -61,7 +61,7 @@ def get_checks(content, sol_file_path):
constructors.append(line) constructors.append(line)
if line.startswith("ABI_CHECK") or line.startswith("BOOST_REQUIRE"): if line.startswith("ABI_CHECK") or line.startswith("BOOST_REQUIRE"):
checks.append(line) checks.append(line)
sol_file = open(sol_file_path, "r") with open(sol_file_path, "r") as sol_file:
sol_constructors = [] sol_constructors = []
sol_checks = [] sol_checks = []
inside_expectations = False inside_expectations = False
@ -80,7 +80,7 @@ def get_checks(content, sol_file_path):
def show_test(name, content, sol_file_path, current_test, test_count): def show_test(name, content, sol_file_path, current_test, test_count):
cpp_file = tempfile.NamedTemporaryFile(delete=False) with tempfile.NamedTemporaryFile(delete=False) as cpp_file:
cpp_file.write(content.encode()) cpp_file.write(content.encode())
cpp_file.close() cpp_file.close()
@ -118,7 +118,7 @@ def get_tests(e2e_path):
def process_input_file(e2e_path, input_file, interactive): def process_input_file(e2e_path, input_file, interactive):
tests = get_tests(e2e_path) tests = get_tests(e2e_path)
cpp_file = open(input_file, "r") with open(input_file, "r") as cpp_file:
inside_test = False inside_test = False
test_name = "" test_name = ""
inside_extracted_test = False inside_extracted_test = False

View File

@ -75,7 +75,7 @@ class TraceAnalyser:
self.ready = False self.ready = False
def analyse(self): def analyse(self):
trace_file = open(self.file, "r") with open(self.file, "r") as trace_file:
trace = None trace = None
test_case = None test_case = None
for line in trace_file.readlines(): for line in trace_file.readlines():

View File

@ -45,7 +45,7 @@ import sys
def readDependencies(fname): def readDependencies(fname):
with open(fname) as f: with open(fname) as f:
o = subprocess.Popen(['otool', '-L', fname], stdout=subprocess.PIPE) with subprocess.Popen(['otool', '-L', fname], stdout=subprocess.PIPE) as o:
for line in o.stdout: for line in o.stdout:
if line[0] == '\t': if line[0] == '\t':
library = line.split(' ', 1)[0][1:] library = line.split(' ', 1)[0][1:]

View File

@ -67,10 +67,10 @@ class regressor():
if not env: if not env:
env = os.environ.copy() env = os.environ.copy()
logfh = open(logfile, 'w') with open(logfile, 'w') as logfh:
proc = subprocess.Popen(command, shell=True, executable='/bin/bash', with subprocess.Popen(command, shell=True, executable='/bin/bash',
env=env, stdout=logfh, env=env, stdout=logfh,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT) as proc:
ret = proc.wait() ret = proc.wait()
logfh.close() logfh.close()
return ret return ret

View File

@ -42,7 +42,7 @@ def writeSourceToFile(lines):
# print("filePath is", filePath) # print("filePath is", filePath)
if filePath != False: if filePath != False:
os.system("mkdir -p " + filePath) os.system("mkdir -p " + filePath)
f = open(srcName, mode='a+', encoding='utf8', newline='') with open(srcName, mode='a+', encoding='utf8', newline='') as f:
createdSources.append(srcName) createdSources.append(srcName)
i = 0 i = 0
for idx, line in enumerate(lines[1:]): for idx, line in enumerate(lines[1:]):