From 8eb02d1c3465e591f849968dea03bd3e5b4c0355 Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Thu, 4 Jul 2024 15:26:19 +0100 Subject: [PATCH] code_wrapper: Doc-string fixes. Signed-off-by: Minos Galanakis --- scripts/mbedtls_framework/c_wrapper_generator.py | 4 +--- .../mbedtls_framework/code_wrapper/psa_wrapper.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/mbedtls_framework/c_wrapper_generator.py b/scripts/mbedtls_framework/c_wrapper_generator.py index fbf3b51e3..4f7e5c8ff 100644 --- a/scripts/mbedtls_framework/c_wrapper_generator.py +++ b/scripts/mbedtls_framework/c_wrapper_generator.py @@ -67,7 +67,6 @@ class Base: This includes a description comment and some include directives. """ - prologue = textwrap.dedent(""" /* Automatically generated by generate_psa_wrappers.py, do not edit! */ @@ -98,8 +97,7 @@ class Base: out.write(prologue) def _write_epilogue(self, out: typing_util.Writable, header: bool) -> None: - """Write the epilogue of a C file. - """ + """Write the epilogue of a C file.""" epilogue = "" if header: epilogue += textwrap.dedent(""" diff --git a/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py b/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py index 1d4490bc5..51bc676c2 100644 --- a/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py +++ b/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py @@ -100,10 +100,10 @@ class PSAWrapper(c_wrapper_generator.Base): c_parsing_helper.read_function_declarations(self.functions, header_path) def rel_path(self, filename: str, path_list: List[str] = ['include', 'psa']) -> str: - """ Return the estimated path in relationship to the. - mbedtls_root. The method allows overriding the targetted sub-directory. - Currently the default is set to mbedtls_root/include/psa """ + """Return the estimated path in relationship to the mbedtls_root. + The method allows overriding the targetted sub-directory. + Currently the default is set to mbedtls_root/include/psa.""" # Temporary, while Mbed TLS does not just rely on the TF-PSA-Crypto # build system to build its crypto library. When it does, the first # case can just be removed. @@ -116,8 +116,10 @@ class PSAWrapper(c_wrapper_generator.Base): # Utility Methods @staticmethod def parse_def_guards(def_list: Collection[str])-> str: - """ Parse an input list of format [[[C] preprocessor] macro, ...] and generate a - c compatible defined() && !defined() syntax string""" + """ Create define guards. + + Parses an input list of format [[[C] preprocessor] macro, ...] and + generates a c compatible defined() && !defined() syntax string.""" output = "" dl = [("defined({})".format(n) if n[0] != "!" else @@ -170,6 +172,7 @@ class PSAWrapper(c_wrapper_generator.Base): buffer_parameters: List['BufferParameter'], poison: bool) -> None: """Write poisoning or unpoisoning code for the buffer parameters. + Write poisoning code if poison is true, unpoisoning code otherwise. """