1
0

More strict fetching validation

This commit is contained in:
Jon Michael Aanes 2024-11-24 18:33:17 +01:00
parent 188249e39f
commit ec27c7e4e0
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
3 changed files with 3 additions and 4 deletions

View File

@ -238,7 +238,7 @@ def import_data(obsidian_path: Path, dry_run=True):
num_updated = import_step_counts_csv(vault, rows) num_updated = import_step_counts_csv(vault, rows)
logger.info('Updated %d files', num_updated) 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) import_watched_series_csv_from_file(vault)
num_dirty = len([f for f in vault.internal_file_text_cache.values() if f.is_dirty]) num_dirty = len([f for f in vault.internal_file_text_cache.values() if f.is_dirty])

View File

@ -167,7 +167,6 @@ class ObsidianVault:
events.sort(key=lambda x: x.verb or '') events.sort(key=lambda x: x.verb or '')
date_sentinel = datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=contents.timezone) 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) 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 = ['- ' + format_event_string(e, tz = contents.timezone) for e in events]
formatted_events = list(dict.fromkeys(formatted_events)) formatted_events = list(dict.fromkeys(formatted_events))

View File

@ -19,8 +19,8 @@ def csv_safe_value(v: Any) -> str:
if isinstance(v, urllib.parse.ParseResult): if isinstance(v, urllib.parse.ParseResult):
return v.geturl() return v.geturl()
if isinstance(v, datetime.datetime): if isinstance(v, datetime.datetime):
if v.tzinfo is None: if v.tzinfo is None or v.tzinfo != datetime.UTC:
raise RuntimeError(v) raise ValueError(v)
return str(v) return str(v)