From f720789c959fedcf906ce37f0fa6da4b24514b25 Mon Sep 17 00:00:00 2001 From: Daniel Viegas Date: Sun, 30 Nov 2025 01:24:08 +0100 Subject: [PATCH] Refactor: Improve Pythonic code style - Replace len() > 0 with direct boolean check for better Pythonic code - Optimize dictionary iteration by removing unnecessary .keys() calls These changes improve code readability and follow Python best practices by using more idiomatic patterns. --- MyTimeline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MyTimeline.py b/MyTimeline.py index 4a3ca3d..a194d0e 100644 --- a/MyTimeline.py +++ b/MyTimeline.py @@ -860,7 +860,7 @@ class MyTimelineView(NavigationView): category_event_types = {} # Map category to list of event types # First pass: collect event types by category - for event_type_obj in EVENT_COLORS.keys(): + for event_type_obj in EVENT_COLORS: if event_type_obj not in EVENT_CATEGORIES: continue category = EVENT_CATEGORIES[event_type_obj] @@ -869,7 +869,7 @@ class MyTimelineView(NavigationView): category_event_types[category].append(event_type_obj) # Second pass: create UI with category checkboxes - for category in sorted(category_event_types.keys()): + for category in sorted(category_event_types): event_types_in_category = category_event_types[category] # Create category checkbox with three-state support @@ -1243,7 +1243,7 @@ class MyTimelineView(NavigationView): add_person_checkbox(child_ref.ref, _('Child')) # Only add expander if there are members to show - if len(members_box.get_children()) > 0: + if members_box.get_children(): # Create family checkbox with three-state support family_checkbox = Gtk.CheckButton(label=family_name)