From 90121061eb9cb42f07b15027e2a920841cfe4dfe Mon Sep 17 00:00:00 2001 From: Juhani Krekelä Date: Fri, 11 Oct 2024 22:33:31 +0300 Subject: Pass title_map explicitly when formatting WatchLaterEntry WatchLaterEntry's __str__ method implicitly depends on the title_map variable existing in the global scope. This makes the dependency on the title_map explicit. --- later | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/later b/later index 2f13872..5289f2d 100755 --- a/later +++ b/later @@ -42,7 +42,7 @@ class WatchLaterEntry: path: str mtime: dt - def __str__(self): + def format(self, title_map): def format_time(time): now = dt.now() if time < now - datetime.timedelta(days=7): @@ -171,6 +171,6 @@ args = parser.parse_args() title_map = TitleMap(title_map_file, update=args.update_titles) for entry in entries(): - print(entry) + print(entry.format(title_map)) title_map.maybe_commit() -- cgit v1.2.3-2-gb3c3