Commit a63580d4 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'format_python_files' into 'main'

Format python files

See merge request !1393
parents dc822a65 b95b3084
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
#! /usr/bin/env python3
import pathlib
import argparse
import pathlib
import re


TEST_TYPES = ["sanitizers"]


+2 −2
Original line number Diff line number Diff line
@@ -30,8 +30,8 @@
"""

import argparse
import numpy as np

import numpy as np

ERR_MAGIC_NUM_DLY_PROF = -1
ERR_MAGIC_NUM_G192 = 27424
+7 −3
Original line number Diff line number Diff line
import re
import argparse
import re


def process_file(file_path: str, defines_re):
@@ -13,7 +13,9 @@ def process_file(file_path: str, defines_re):
    for i, line in enumerate(lines):
        for name, regex in defines_re.items():
            # Spaces are replaced with underscores to avoid matching on multiple runs
            lines[i] = regex.sub(lambda x: f"/* {x.group(0).replace(' ', '_')} */", line)
            lines[i] = regex.sub(
                lambda x: f"/* {x.group(0).replace(' ', '_')} */", line
            )

            if lines[i] != line:
                num_subbed[name] += 1
@@ -41,7 +43,9 @@ def main(args):


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Comment out preprocessor defines in c/c++ files")
    parser = argparse.ArgumentParser(
        description="Comment out preprocessor defines in c/c++ files"
    )
    parser.add_argument("-f", "--files", nargs="+", required=True, type=str)
    parser.add_argument("-d", "--defines", nargs="+", required=True, type=str)
    main(parser.parse_args())
+1 −1
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.
import csv
import sys
import re
import sys

newsletterFilename = ""
newsletterFilenameLast = ""
+4 −2
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.
import csv
import sys
import re
import sys

newsletterFilename = ""
newsletterFilenameLast = ""
@@ -65,7 +65,9 @@ with open(newsletterFilenameTROM, "r") as csvfile:
# now we have the following format
# PROM enc, PROM dec, PROM com, PROM rend, PROM total, TROM enc, TROM dec, TROM com, TROM rend, TROM total

print("conf;PROM enc;PROM dec;PROM com;PROM rend;PROM total;TROM enc;TROM dec;TROM com;TROM rend;TROM total;total")
print(
    "conf;PROM enc;PROM dec;PROM com;PROM rend;PROM total;TROM enc;TROM dec;TROM com;TROM rend;TROM total;total"
)

for key in rom_table:
    rom = rom_table[key]
Loading