From cb093cc030add2e8402c77bcc1a3de7551bf1c09 Mon Sep 17 00:00:00 2001 From: Abdelrahman Said Date: Sun, 2 Mar 2025 12:20:02 +0000 Subject: [PATCH] Move load_func_body_from_file to utils module --- codegen/codegen.py | 6 +----- codegen/utils.py | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 codegen/utils.py diff --git a/codegen/codegen.py b/codegen/codegen.py index 159919f..f7d524f 100644 --- a/codegen/codegen.py +++ b/codegen/codegen.py @@ -1,4 +1,5 @@ from pathlib import Path +from .utils import load_func_body_from_file from .datatypes import ( CDataType, CStruct, @@ -307,8 +308,3 @@ def test_doubly_linked_list(): header.save(Path(".")) source.save(Path(".")) - - -def load_func_body_from_file(filename: Path) -> str: - with open(filename, "r") as infile: - return infile.read() diff --git a/codegen/utils.py b/codegen/utils.py new file mode 100644 index 0000000..5247512 --- /dev/null +++ b/codegen/utils.py @@ -0,0 +1,6 @@ +from pathlib import Path + + +def load_func_body_from_file(filename: Path) -> str: + with open(filename, "r") as infile: + return infile.read()