From ec27c7e4e004b96659c052d0d967d98ca76a944b Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Sun, 24 Nov 2024 18:33:17 +0100 Subject: [PATCH] More strict fetching validation --- obsidian_import/__init__.py | 2 +- obsidian_import/obsidian.py | 1 - personal_data/util.py | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/obsidian_import/__init__.py b/obsidian_import/__init__.py index e779a8c..3c3b1c3 100644 --- a/obsidian_import/__init__.py +++ b/obsidian_import/__init__.py @@ -238,7 +238,7 @@ def import_data(obsidian_path: Path, dry_run=True): num_updated = import_step_counts_csv(vault, rows) logger.info('Updated %d files', num_updated) - #import_played_games_csv_from_file(vault) + import_played_games_csv_from_file(vault) import_watched_series_csv_from_file(vault) num_dirty = len([f for f in vault.internal_file_text_cache.values() if f.is_dirty]) diff --git a/obsidian_import/obsidian.py b/obsidian_import/obsidian.py index 00b0e94..66e5c6e 100644 --- a/obsidian_import/obsidian.py +++ b/obsidian_import/obsidian.py @@ -167,7 +167,6 @@ class ObsidianVault: events.sort(key=lambda x: x.verb or '') date_sentinel = datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=contents.timezone) events.sort(key=lambda x: x.start_time or x.end_time or date_sentinel) - #print(events) formatted_events = ['- ' + format_event_string(e, tz = contents.timezone) for e in events] formatted_events = list(dict.fromkeys(formatted_events)) diff --git a/personal_data/util.py b/personal_data/util.py index f449c12..0afd187 100644 --- a/personal_data/util.py +++ b/personal_data/util.py @@ -19,8 +19,8 @@ def csv_safe_value(v: Any) -> str: if isinstance(v, urllib.parse.ParseResult): return v.geturl() if isinstance(v, datetime.datetime): - if v.tzinfo is None: - raise RuntimeError(v) + if v.tzinfo is None or v.tzinfo != datetime.UTC: + raise ValueError(v) return str(v)