privilege registry: simplify writing headers

This patch reused similar patterns in |REGISTRY_HEADER| so that the
python code is more readable. It also moved the clang-format off macro
and warning a bit in so they are all consistent with each other.

Tested: code compiles.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: If18de0d9f89088f9b5732613ecf59520650bb11a
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index de560d8..8c300ed 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -4,6 +4,9 @@
 
 import requests
 
+PRAGMA_ONCE = '''#pragma once
+'''
+
 WARNING = '''/****************************************************************
  *                 READ THIS WARNING FIRST
  * This is an auto-generated header which contains definitions
@@ -15,8 +18,7 @@
  * github organization.
  ***************************************************************/'''
 
-REGISTRY_HEADER = WARNING + '''
-#pragma once
+REGISTRY_HEADER = PRAGMA_ONCE + WARNING + '''
 #include <registries.hpp>
 
 // clang-format off
@@ -163,23 +165,22 @@
     return "Or".join(names)
 
 
+PRIVILEGE_HEADER = PRAGMA_ONCE + WARNING + '''
+#include <privileges.hpp>
+
+// clang-format off
+
+namespace redfish::privileges
+{
+'''
+
+
 def make_privilege_registry():
     path, json_file, type_name, url = \
         make_getter('Redfish_1.3.0_PrivilegeRegistry.json',
                     'privilege_registry.hpp', 'privilege')
     with open(path, 'w') as registry:
-        registry.write(
-            "#pragma once\n"
-            "{WARNING}\n"
-            "// clang-format off\n"
-            "\n"
-            "#include <privileges.hpp>\n"
-            "\n"
-            "namespace redfish::privileges\n"
-            "{{\n"
-            .format(
-                WARNING=WARNING,
-                filename=os.path.basename(path)))
+        registry.write(PRIVILEGE_HEADER)
 
         privilege_dict = {}
         for mapping in json_file["Mappings"]: