Merge pull request #150 from erendn/fix_whitespace

Fix whitespace
This commit is contained in:
Matt Guthaus 2022-07-22 13:38:48 -07:00 committed by GitHub
commit f1e452c8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 733 additions and 758 deletions

View File

@ -220,4 +220,3 @@ class lef:
round(item[1], round(item[1],
self.round_grid))) self.round_grid)))
self.lef.write(" ;\n") self.lef.write(" ;\n")

View File

@ -153,4 +153,3 @@ class timing_graph():
""" override print function output """ """ override print function output """
return str(self) return str(self)

View File

@ -118,5 +118,3 @@ class cacti(simulation):
debug.info(1, "Dynamic Power: {0} mW".format(power.dynamic)) debug.info(1, "Dynamic Power: {0} mW".format(power.dynamic))
debug.info(1, "Leakage Power: {0} mW".format(power.leakage)) debug.info(1, "Leakage Power: {0} mW".format(power.leakage))
return power return power

View File

@ -40,4 +40,3 @@ class linear_regression(regression_model):
pred = model.predict(features) pred = model.predict(features)
return pred return pred

View File

@ -211,4 +211,3 @@ class voltage_at_measure(spice_measurement):
meas_name = self.name meas_name = self.name
targ_name = self.targ_name_no_port targ_name = self.targ_name_no_port
return (meas_name, targ_name, time_at) return (meas_name, targ_name, time_at)

View File

@ -448,6 +448,3 @@ class model_check(delay):
name_dict[self.sae_model_name] = name_dict["sae_measures"] name_dict[self.sae_model_name] = name_dict["sae_measures"]
return name_dict return name_dict

View File

@ -41,4 +41,3 @@ class neural_network(regression_model):
pred = model.predict(features) pred = model.predict(features)
reshape_pred = np.reshape(pred, (len(pred),1)) reshape_pred = np.reshape(pred, (len(pred),1))
return reshape_pred return reshape_pred

View File

@ -205,4 +205,3 @@ class regression_model(simulation):
OPTS.model_dict[model_name+"_coef"] = list(model.coef_[0]) OPTS.model_dict[model_name+"_coef"] = list(model.coef_[0])
debug.info(1,"Coefs of {}:{}".format(model_name,OPTS.model_dict[model_name+"_coef"])) debug.info(1,"Coefs of {}:{}".format(model_name,OPTS.model_dict[model_name+"_coef"]))
OPTS.model_dict[model_name+"_intercept"] = float(model.intercept_) OPTS.model_dict[model_name+"_intercept"] = float(model.intercept_)

View File

@ -134,4 +134,3 @@ def bp():
and whenever you encounter the debug.bp() they won't be "reset". and whenever you encounter the debug.bp() they won't be "reset".
""" """
pass pass

View File

@ -290,4 +290,3 @@ class cell_properties():
@property @property
def row_cap_2port(self): def row_cap_2port(self):
return self._row_cap_2port return self._row_cap_2port

View File

@ -267,27 +267,3 @@ if __name__ == "__main__":
input_dir_path = sys.argv[1] input_dir_path = sys.argv[1]
out_path = sys.argv[2] out_path = sys.argv[2]
gen_model_csv(input_dir_path, out_path) gen_model_csv(input_dir_path, out_path)

View File

@ -213,8 +213,3 @@ class grid:
""" """
path.set_path(False) path.set_path(False)
path.set_blocked(True) path.set_blocked(True)

View File

@ -49,4 +49,3 @@ class grid_cell:
type_string += "P" type_string += "P"
return type_string return type_string

View File

@ -102,5 +102,3 @@ class signal_escape_router(router):
# breakpoint() # breakpoint()
self.write_debug_gds("debug_route.gds", True) self.write_debug_gds("debug_route.gds", True)

View File

@ -77,5 +77,3 @@ class supply_grid(signal_grid):
wave = wave_path.neighbor(direct) wave = wave_path.neighbor(direct)
return wave_path return wave_path

View File

@ -392,4 +392,3 @@ class supply_grid_router(router):
debug.info(4, "Blocking supply rail") debug.info(4, "Blocking supply rail")
for rail_name in self.supply_rail_tracks: for rail_name in self.supply_rail_tracks:
self.rg.set_blocked(self.supply_rail_tracks[rail_name]) self.rg.set_blocked(self.supply_rail_tracks[rail_name])

View File

@ -28,6 +28,7 @@ class code_format_test(openram_test):
continue continue
errors += check_file_format_tab(code) errors += check_file_format_tab(code)
errors += check_file_format_carriage(code) errors += check_file_format_carriage(code)
errors += check_file_format_whitespace(code)
for code in source_codes: for code in source_codes:
if re.search("gdsMill", code): if re.search("gdsMill", code):
@ -51,7 +52,7 @@ def setup_files(path):
files = [] files = []
for (dir, _, current_files) in os.walk(path): for (dir, _, current_files) in os.walk(path):
for f in current_files: for f in current_files:
files.append(os.getenv("OPENRAM_HOME")) files.append(os.path.join(dir, f))
nametest = re.compile("\.py$", re.IGNORECASE) nametest = re.compile("\.py$", re.IGNORECASE)
select_files = list(filter(nametest.search, files)) select_files = list(filter(nametest.search, files))
return select_files return select_files
@ -92,13 +93,35 @@ def check_file_format_carriage(file_name):
if len(key_positions)>10: if len(key_positions)>10:
line_numbers = key_positions[:10] + [" ..."] line_numbers = key_positions[:10] + [" ..."]
else: else:
line_numbers = key_positoins line_numbers = key_positions
debug.info(0, '\nFound ' + str(len(key_positions)) + ' carriage returns in ' + debug.info(0, '\nFound ' + str(len(key_positions)) + ' carriage returns in ' +
str(file_name) + ' (lines ' + ",".join(str(x) for x in line_numbers) + ')') str(file_name) + ' (lines ' + ",".join(str(x) for x in line_numbers) + ')')
f.close() f.close()
return len(key_positions) return len(key_positions)
def check_file_format_whitespace(file_name):
"""
Check if file contains a line with whitespace at the end
and return the number of these lines.
"""
f = open(file_name, "r")
key_positions = []
for num, line in enumerate(f.readlines()):
if re.match(r".*[ \t]$", line):
key_positions.append(num)
if len(key_positions) > 0:
if len(key_positions) > 10:
line_numbers = key_positions[:10] + [" ..."]
else:
line_numbers = key_positions
debug.info(0, "\nFound " + str(len(key_positions)) + " ending whitespace in " +
str(file_name) + " (lines " + ",".join(str(x) for x in line_numbers) + ")")
f.close()
return len(key_positions)
def check_print_output(file_name): def check_print_output(file_name):
"""Check if any files (except debug.py) call the _print_ function. We should """Check if any files (except debug.py) call the _print_ function. We should
use the debug output with verbosity instead!""" use the debug output with verbosity instead!"""