Skip to content

Commit 18304b2

Browse files
author
MohamedElgammal
committed
fixing all python formatting issues
1 parent c24dc8f commit 18304b2

File tree

7 files changed

+52
-52
lines changed

7 files changed

+52
-52
lines changed

dev/pylint_check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191

9292
class TermColor:
93-
""" Terminal codes for printing in color """
93+
"""Terminal codes for printing in color"""
9494

9595
# pylint: disable=too-few-public-methods
9696

@@ -105,14 +105,14 @@ class TermColor:
105105

106106

107107
def error(*msg, returncode=-1):
108-
""" Print an error message and exit program """
108+
"""Print an error message and exit program"""
109109

110110
print(TermColor.RED + "ERROR:", " ".join(str(item) for item in msg), TermColor.END)
111111
sys.exit(returncode)
112112

113113

114114
def expand_paths():
115-
""" Build a list of all python files to process by going through 'paths_to_lint' """
115+
"""Build a list of all python files to process by going through 'paths_to_lint'"""
116116

117117
paths = []
118118
for (path, is_recursive) in paths_to_lint:

run_reg_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
def vtr_command_argparser(prog=None):
25-
""" Parses the arguments of run_reg_test """
25+
"""Parses the arguments of run_reg_test"""
2626

2727
description = textwrap.dedent(
2828
"""
@@ -205,7 +205,7 @@ def vtr_command_main(arg_list, prog=None):
205205

206206

207207
def display_qor(reg_test):
208-
""" Display the qor tests script files to be run outside of this script """
208+
"""Display the qor tests script files to be run outside of this script"""
209209
test_dir = paths.regression_tests_path / reg_test
210210
if not (test_dir / "qor_geomean.txt").is_file():
211211
print("QoR results do not exist ({}/qor_geomean.txt)".format(str(test_dir)))
@@ -250,7 +250,7 @@ def display_qor(reg_test):
250250

251251

252252
def run_odin_test(args, test_name):
253-
""" Run ODIN II test with given test name """
253+
"""Run ODIN II test with given test name"""
254254
odin_reg_script = [
255255
str(paths.odin_verify_path),
256256
"--clean",
@@ -294,7 +294,7 @@ def run_odin_test(args, test_name):
294294

295295

296296
def collect_task_list(reg_test):
297-
""" create a list of task files """
297+
"""create a list of task files"""
298298
task_list_filepath = paths.tasks_path / "regression_tests" / reg_test / "task_list.txt"
299299
if not task_list_filepath.is_file():
300300
raise IOError("Test does not exist: {}".format(reg_test))
@@ -316,7 +316,7 @@ def run_tasks(args, task_lists):
316316

317317

318318
def parse_single_test(task_lists, check=True, calculate=True, create=False):
319-
""" parse the test results """
319+
"""parse the test results"""
320320
vtr_task_cmd = ["-l"] + [task_lists]
321321
if check:
322322
vtr_task_cmd += ["-check_golden"]
@@ -330,7 +330,7 @@ def parse_single_test(task_lists, check=True, calculate=True, create=False):
330330

331331

332332
def print_header(heading, divider="=", print_first_line=True):
333-
""" Print heading formated in the center of two lines """
333+
"""Print heading formated in the center of two lines"""
334334
if print_first_line:
335335
print(divider * len(heading) * 2)
336336
print(" " * int((len(heading) / 2)), end="")

vtr_flow/scripts/python_libs/vtr/log_parse.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
class ParsePattern:
21-
""" Pattern for parsing log files """
21+
"""Pattern for parsing log files"""
2222

2323
def __init__(self, name, filename, regex_str, default_value=None):
2424
self._name = name
@@ -27,44 +27,44 @@ def __init__(self, name, filename, regex_str, default_value=None):
2727
self._default_value = default_value
2828

2929
def name(self):
30-
""" Return name of what is being parsed for """
30+
"""Return name of what is being parsed for"""
3131
return self._name
3232

3333
def filename(self):
34-
""" Log filename to parse """
34+
"""Log filename to parse"""
3535
return self._filename
3636

3737
def regex(self):
38-
""" Regex expression to use for parsing """
38+
"""Regex expression to use for parsing"""
3939
return self._regex
4040

4141
def default_value(self):
42-
""" Return the default parse value """
42+
"""Return the default parse value"""
4343
return self._default_value
4444

4545

4646
class PassRequirement(abc.ABC):
47-
""" Used to check if a parsed value passes an expression """
47+
"""Used to check if a parsed value passes an expression"""
4848

4949
def __init__(self, metric):
5050
self._metric = metric
5151
self._type = type
5252

5353
def metric(self):
54-
""" Return pass matric """
54+
"""Return pass matric"""
5555
return self._metric
5656

5757
@abc.abstractmethod
5858
def type(self):
59-
""" Return the type of requirement checking """
59+
"""Return the type of requirement checking"""
6060

6161
@abc.abstractmethod
6262
def check_passed(self, golden_value, check_value, check_string="golden value"):
63-
""" Return whether the check passed """
63+
"""Return whether the check passed"""
6464

6565

6666
class EqualPassRequirement(PassRequirement):
67-
""" Used to check if parsed value is equal to golden value """
67+
"""Used to check if parsed value is equal to golden value"""
6868

6969
def type(self):
7070
return "Equal"
@@ -82,7 +82,7 @@ def check_passed(self, golden_value, check_value, check_string="golden value"):
8282

8383

8484
class RangePassRequirement(PassRequirement):
85-
""" Used to check if parsed value is within a range """
85+
"""Used to check if parsed value is within a range"""
8686

8787
def __init__(self, metric, min_value=None, max_value=None):
8888
super().__init__(metric)
@@ -97,15 +97,15 @@ def type(self):
9797
return "Range"
9898

9999
def min_value(self):
100-
""" Get min value of golden range """
100+
"""Get min value of golden range"""
101101
return self._min_value
102102

103103
def max_value(self):
104-
""" Get max value of golden range """
104+
"""Get max value of golden range"""
105105
return self._max_value
106106

107107
def check_passed(self, golden_value, check_value, check_string="golden value"):
108-
""" Check if parsed value is within a range or equal to golden value """
108+
"""Check if parsed value is within a range or equal to golden value"""
109109

110110
if golden_value is None or check_value is None:
111111
if golden_value is None and check_value is None:
@@ -165,7 +165,7 @@ def check_passed(self, golden_value, check_value, check_string="golden value"):
165165

166166

167167
class RangeAbsPassRequirement(PassRequirement):
168-
""" Check if value is in some relative ratio range, or below some absolute value """
168+
"""Check if value is in some relative ratio range, or below some absolute value"""
169169

170170
def __init__(self, metric, min_value=None, max_value=None, abs_threshold=None):
171171
super().__init__(metric)
@@ -178,19 +178,19 @@ def __init__(self, metric, min_value=None, max_value=None, abs_threshold=None):
178178
self._abs_threshold = abs_threshold
179179

180180
def type(self):
181-
""" Return requirement type """
181+
"""Return requirement type"""
182182
return "Range"
183183

184184
def min_value(self):
185-
""" Return min value of ratio range """
185+
"""Return min value of ratio range"""
186186
return self._min_value
187187

188188
def max_value(self):
189-
""" Return max value of ratio range """
189+
"""Return max value of ratio range"""
190190
return self._max_value
191191

192192
def abs_threshold(self):
193-
""" Get absolute threshold """
193+
"""Get absolute threshold"""
194194
return self._abs_threshold
195195

196196
def check_passed(self, golden_value, check_value, check_string="golden value"):
@@ -267,27 +267,27 @@ def check_passed(self, golden_value, check_value, check_string="golden value"):
267267

268268

269269
class ParseResults:
270-
""" This class contains all parse results and metrics """
270+
"""This class contains all parse results and metrics"""
271271

272272
PRIMARY_KEYS = ("architecture", "circuit", "script_params")
273273

274274
def __init__(self):
275275
self._metrics = OrderedDict()
276276

277277
def add_result(self, arch, circuit, parse_result, script_param=None):
278-
""" Add new parse result for given arch/circuit pair """
278+
"""Add new parse result for given arch/circuit pair"""
279279
script_param = load_script_param(script_param)
280280
self._metrics[(arch, circuit, script_param)] = parse_result
281281

282282
def metrics(self, arch, circuit, script_param=None):
283-
""" Return individual metric based on the architechure, circuit and script"""
283+
"""Return individual metric based on the architechure, circuit and script"""
284284
script_param = load_script_param(script_param)
285285
if (arch, circuit, script_param) in self._metrics:
286286
return self._metrics[(arch, circuit, script_param)]
287287
return None
288288

289289
def all_metrics(self):
290-
""" Return all metric results """
290+
"""Return all metric results"""
291291
return self._metrics
292292

293293

vtr_flow/scripts/python_libs/vtr/parse_vtr_task.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def parse_task(config, config_jobs, flow_metrics_basename=FIRST_PARSE_FILE):
228228

229229

230230
def parse_files(config_jobs, run_dir, flow_metrics_basename=FIRST_PARSE_FILE):
231-
""" Parse the result files from the give jobs """
231+
"""Parse the result files from the give jobs"""
232232
task_parse_results_filepath = str(PurePath(run_dir) / flow_metrics_basename)
233233
with open(task_parse_results_filepath, "w") as out_f:
234234

@@ -262,7 +262,7 @@ def parse_files(config_jobs, run_dir, flow_metrics_basename=FIRST_PARSE_FILE):
262262

263263

264264
def create_golden_results_for_tasks(configs):
265-
""" Runs create_golden_results_for_task on all of the give configuration """
265+
"""Runs create_golden_results_for_task on all of the give configuration"""
266266

267267
for config in configs:
268268
create_golden_results_for_task(config)
@@ -281,7 +281,7 @@ def create_golden_results_for_task(config):
281281

282282

283283
def check_golden_results_for_tasks(configs):
284-
""" runs check_golden_results_for_task on all the input configurations """
284+
"""runs check_golden_results_for_task on all the input configurations"""
285285
num_qor_failures = 0
286286

287287
print("\nCalculating QoR results...")
@@ -347,7 +347,7 @@ def check_two_files(
347347
first_name="task",
348348
second_name="golden",
349349
):
350-
""" Compare two files results """
350+
"""Compare two files results"""
351351
first_results = load_parse_results(first_results_filepath)
352352
second_results = load_parse_results(second_results_filepath)
353353
# Verify that the architecture and circuit are specified
@@ -461,7 +461,7 @@ def check_two_files(
461461

462462

463463
def summarize_qor(configs):
464-
""" Summarize the Qor results """
464+
"""Summarize the Qor results"""
465465

466466
first = True
467467
task_path = Path(configs[0].config_dir).parent
@@ -483,7 +483,7 @@ def summarize_qor(configs):
483483

484484

485485
def calc_geomean(args, configs):
486-
""" caclulate and ouput the geomean values to the geomean file """
486+
"""caclulate and ouput the geomean values to the geomean file"""
487487
first = False
488488
task_path = Path(configs[0].config_dir).parent
489489
if len(configs) > 1 or (task_path.parent / "task_list.txt").is_file():
@@ -533,7 +533,7 @@ def calc_geomean(args, configs):
533533

534534

535535
def calculate_individual_geo_mean(lines, index, geo_mean, num):
536-
""" Calculate an individual line of parse results goe_mean """
536+
"""Calculate an individual line of parse results goe_mean"""
537537
previous_value = None
538538
for line in lines:
539539
line = line.split("\t")[4:]
@@ -551,7 +551,7 @@ def calculate_individual_geo_mean(lines, index, geo_mean, num):
551551

552552

553553
def find_latest_run_dir(config):
554-
""" Find the latest run directory for given configuration """
554+
"""Find the latest run directory for given configuration"""
555555
task_dir = find_task_dir(config)
556556

557557
run_dir = get_latest_run_dir(task_dir)

vtr_flow/scripts/python_libs/vtr/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def create_job(
462462
# determine spacing for nice output
463463
num_spaces_before = int((longest_name - len(config.task_name))) + 8
464464
num_spaces_after = int((longest_arch_circuit - len(work_dir + "/{}".format(param_string))))
465-
465+
466466
expected_min_w = ret_expected_min_w(circuit, arch, golden_results, param)
467467
expected_min_w = (
468468
int(expected_min_w * args.minw_hint_factor)

vtr_flow/scripts/python_libs/vtr/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def check_cmd(command):
217217

218218

219219
def pretty_print_table(file, border=False):
220-
""" Convert file to a pretty, easily read table """
220+
"""Convert file to a pretty, easily read table"""
221221
table = PrettyTable()
222222
table.border = border
223223
reader = None

0 commit comments

Comments
 (0)