From da5d317797155c8599b5b5d1e59609dcc440e1da Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Mon, 10 Jun 2024 18:16:11 -0400 Subject: [PATCH] [2114] Additional Cleanup --- EDMC.py | 2 +- EDMCSystemProfiler.py | 2 +- l10n.py | 6 +++--- loadout.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/EDMC.py b/EDMC.py index 55236b9c..ce0db95b 100755 --- a/EDMC.py +++ b/EDMC.py @@ -230,7 +230,7 @@ def main(): # noqa: C901, CCR001 try: monitor.currentdir = Path(config.get_str('journaldir', default=config.default_journal_dir)) if not monitor.currentdir: - monitor.currentdir = Path(config.default_journal_dir) + monitor.currentdir = config.default_journal_dir_path logger.debug(f'logdir = "{monitor.currentdir}"') logfile = monitor.journal_newest_filename(monitor.currentdir) diff --git a/EDMCSystemProfiler.py b/EDMCSystemProfiler.py index 816c5e8b..77212db7 100644 --- a/EDMCSystemProfiler.py +++ b/EDMCSystemProfiler.py @@ -49,7 +49,7 @@ def get_sys_report(config: config.AbstractConfig) -> str: ) ) if not monitor.currentdir: - monitor.currentdir = pathlib.Path(config.default_journal_dir) + monitor.currentdir = config.default_journal_dir_path try: logfile = monitor.journal_newest_filename(monitor.currentdir) if logfile is None: diff --git a/l10n.py b/l10n.py index 8367d72c..ce1ab6a7 100755 --- a/l10n.py +++ b/l10n.py @@ -232,7 +232,7 @@ class Translations: if __file__: return pathlib.Path(__file__).parent.joinpath(LOCALISATION_DIR).resolve() - return pathlib.Path(LOCALISATION_DIR).resolve() + return LOCALISATION_DIR.resolve() def file(self, lang: str, plugin_path: pathlib.Path | None = None) -> TextIO | None: """ @@ -396,8 +396,8 @@ if __name__ == "__main__": (match.group(4) and (match.group(4)[1:].strip()) + '. ' or '') + f'[{pathlib.Path(f).name}]' ) if seen: - target_path = pathlib.Path(LOCALISATION_DIR / 'en.template.new') - pathlib.Path(target_path).parent.mkdir(parents=True, exist_ok=True) + target_path = LOCALISATION_DIR / 'en.template.new' + target_path.parent.mkdir(parents=True, exist_ok=True) with open(target_path, 'w', encoding='utf-8') as target_file: target_file.write(f'/* Language name */\n"{LANGUAGE_ID}" = "English";\n\n') for thing in sorted(seen, key=str.lower): diff --git a/loadout.py b/loadout.py index f2efc9b4..144439c0 100644 --- a/loadout.py +++ b/loadout.py @@ -53,9 +53,9 @@ def export(data: companion.CAPIData, requested_filename: str | None = None) -> N # Write - output_directory = config.get_str('outdir') + output_directory = Path(config.get_str('outdir')) ship_time = time.strftime('%Y-%m-%dT%H.%M.%S', time.localtime(query_time)) - file_path = output_directory / Path(f"{ship}.{ship_time}.txt") + file_path = output_directory / f"{ship}.{ship_time}.txt" with open(file_path, 'wt') as h: h.write(string)