From df736be737bc00e88c7fb6d2b5b89017794cee04 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Fri, 24 Mar 2023 18:15:42 +0100
Subject: [PATCH] lint

---
 share/machdeps/make_machdep/make_machdep.py | 25 +++++++++++++--------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/share/machdeps/make_machdep/make_machdep.py b/share/machdeps/make_machdep/make_machdep.py
index 1b47793b227..8c8953f3be4 100755
--- a/share/machdeps/make_machdep/make_machdep.py
+++ b/share/machdeps/make_machdep/make_machdep.py
@@ -151,6 +151,7 @@ def print_machdep(machdep):
         args.dest_file = sys.stdout
     yaml.dump(machdep, args.dest_file, indent=4, sort_keys=True)
 
+
 def make_machdep():
     machdep = {}
     for key in schema.keys():
@@ -238,7 +239,7 @@ def find_value(name, typ, output):
         def conversion(x):
             return x
 
-        default = ''
+        default = ""
 
     else:
         warnings.warn(f"unexpected type '{typ}' for field '{name}', skipping")
@@ -349,22 +350,27 @@ machdep["custom_defs"] = ""
 # in case we have all the predefined macros, custom_defs will be very long.
 # we thus want to output it as a literal block, not a simple string.
 # For that, use a custom object and tell PyYaml to output it in a particular way
-# Based on SO's answer: 
+# Based on SO's answer:
+
+
+class custom_defs(str):
+    pass
 
-class custom_defs(str): pass
 
 def change_style(style, representer):
     def new_representer(dumper, data):
         scalar = representer(dumper, data)
         scalar.style = style
         return scalar
+
     return new_representer
 
+
 from yaml.representer import Representer
 
-custom_defs_representer = change_style('|', Representer.represent_str)
+custom_defs_representer = change_style("|", Representer.represent_str)
 
-yaml.add_representer(custom_defs,custom_defs_representer)
+yaml.add_representer(custom_defs, custom_defs_representer)
 
 cmd = compilation_command + ["-dM", "-E", "-"]
 if args.verbose:
@@ -375,11 +381,12 @@ if proc.returncode == 0:
     for line in proc.stdout.splitlines():
         # Preprocessor emits a warning if we're trying to #undef
         # standard macros. Leave them alone.
-        if re.match(r"#define *__STDC", line): continue
-        macro=re.match(r"#define *(\w+)", line)
+        if re.match(r"#define *__STDC", line):
+            continue
+        macro = re.match(r"#define *(\w+)", line)
         if macro:
-            lines+=f"#undef {macro.group(1)}\n"
-        lines+=f"{line.strip()}\n"
+            lines += f"#undef {macro.group(1)}\n"
+        lines += f"{line.strip()}\n"
     machdep["custom_defs"] = custom_defs(lines)
 else:
     warnings.warn(f"could not determine predefined macros")
-- 
GitLab