diff options
author | jakobst1n <jakob.stendahl@outlook.com> | 2023-10-20 19:35:32 +0200 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2023-10-20 19:35:32 +0200 |
commit | 81f0f8de331b382caad8e82348a3ccbac5bb150e (patch) | |
tree | fdaaeab78ba7cc55336fdbdfae258a15cf5b24f1 /src/journal_lib/parse/preprocessing.py | |
parent | 3bb38fcbbc9703ba22429441604d66f577fc6010 (diff) | |
download | journal-lib-81f0f8de331b382caad8e82348a3ccbac5bb150e.tar.gz journal-lib-81f0f8de331b382caad8e82348a3ccbac5bb150e.zip |
Run black, and do some changes for enabling better syntax expandability
Diffstat (limited to 'src/journal_lib/parse/preprocessing.py')
-rw-r--r-- | src/journal_lib/parse/preprocessing.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/journal_lib/parse/preprocessing.py b/src/journal_lib/parse/preprocessing.py index 6d4a0cf..a9ca676 100644 --- a/src/journal_lib/parse/preprocessing.py +++ b/src/journal_lib/parse/preprocessing.py @@ -1,6 +1,7 @@ import re from pathlib import Path + def preprocess_includes(filepath: Path): """ Reads the file at 'filepath', processing any "include" directives, @@ -8,10 +9,10 @@ def preprocess_includes(filepath: Path): This does not report circular includes, so that would become a infinite loop """ - INCLUDE_RE = re.compile(r'^\s*include\s+([^\n]+)\s*$', re.IGNORECASE) + INCLUDE_RE = re.compile(r"^\s*include\s+([^\n]+)\s*$", re.IGNORECASE) def read_file(file_path): - with open(file_path, 'r') as file: + with open(file_path, "r") as file: return file.readlines() lines = read_file(filepath) @@ -21,8 +22,8 @@ def preprocess_includes(filepath: Path): if match: included_file_path = match.group(1) included_lines = read_file(included_file_path) - lines[i:i+1] = included_lines + lines[i : i + 1] = included_lines else: i += 1 - return ''.join(lines) + return "".join(lines) |