aboutsummaryrefslogtreecommitdiff
path: root/src/journal_lib/parse/preprocessing.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal_lib/parse/preprocessing.py')
-rw-r--r--src/journal_lib/parse/preprocessing.py9
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)