From bbfb470d8f412270da403ff32ad7b708305a6da1 Mon Sep 17 00:00:00 2001 From: Nouri Alnahawi <nouri.alnahawi@h-da.de> Date: Sat, 22 May 2021 17:42:55 +0000 Subject: [PATCH] Apply 4 suggestion(s) to 1 file(s) --- mindmap_gen/mindmap_gen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mindmap_gen/mindmap_gen.py b/mindmap_gen/mindmap_gen.py index 6f77c3e..65b244f 100644 --- a/mindmap_gen/mindmap_gen.py +++ b/mindmap_gen/mindmap_gen.py @@ -52,7 +52,7 @@ class MarkdownParser: entries.append(Entry(dir_name, file_name, file_title, ref_count)) # Write entries to file - f = open("mindmap.md", "w") + f = open("mindmap_gen/mindmap.md", "w", encoding="utf8") f.write(self.generate_mindmap(entries)) f.close() @@ -69,14 +69,14 @@ class MarkdownParser: else: mm_str += (" - " + entry.get_title() + " (Refs: " + str(entry.get_refs()) + ")\n") else: - mm_str += (" - " + entry.get_dir() + "\n") + mm_str += (" - " + entry.get_dir().capitalize() + "\n") mm_str += (" - " + entry.get_title() + " (Refs: " + str(entry.get_refs()) + ")\n") prev_dir = entry.get_dir() return mm_str def get_md_file_title(self, md_file_path): - with open(md_file_path, 'r') as file: + with open(md_file_path, 'r', encoding="utf8") as file: data = file.read() return re.search("title: \"(.*)\"", data).group(1) @@ -92,7 +92,7 @@ class MarkdownParser: def get_md_ref_count(self, md_file_path): ref_regex = "\.\.\/refs#(.+)\)" - file_handle = open(md_file_path, mode='r') + file_handle = open(md_file_path, mode='r', encoding ="utf8") ref_count = 0 for line in file_handle.readlines(): -- GitLab