From 6cf24ebe8e25f1832ae39bf3d945198e790844e5 Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 23 Feb 2026 05:10:06 +0000 Subject: [PATCH 1/3] fix: handle None return from get_setting in get_classes When the "classes" setting exists on the server but has a null/empty value, get_setting returns None without raising an exception. The subsequent list comprehension then fails with: TypeError: 'NoneType' object is not iterable Add a None/empty guard to fall back to default_classes, matching the existing exception-handling behavior. Fixes ActivityWatch/activitywatch#1186 --- aw_client/classes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aw_client/classes.py b/aw_client/classes.py index 3f07cae..45038cc 100644 --- a/aw_client/classes.py +++ b/aw_client/classes.py @@ -80,5 +80,10 @@ def get_classes() -> List[Tuple[List[str], dict]]: "Failed to get classes from server, using default classes as fallback" ) return default_classes + if not classes: + logger.warning( + "Classes setting is empty/unset, using default classes as fallback" + ) + return default_classes # map into list of tuples return [(v["name"], v["rule"]) for v in classes] From 2d1b1363f27b09ae56c8f7f24fa9a979455751a8 Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 23 Feb 2026 06:04:48 +0000 Subject: [PATCH 2/3] style: fix black formatting --- aw_client/cli.py | 8 +++++--- examples/suggest_categories.py | 1 - examples/working_hours.py | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aw_client/cli.py b/aw_client/cli.py index c4e3000..c1215ed 100755 --- a/aw_client/cli.py +++ b/aw_client/cli.py @@ -103,9 +103,11 @@ def events(obj: _Context, bucket_id: str): @click.option("--json", "_json", is_flag=True) @click.option("--start", default=now - td1day, type=click.DateTime()) @click.option("--stop", default=now + td1yr, type=click.DateTime()) -@click.option("--timezone", - help="Time zone for start and stop options." - " Must be a valid IANA identifier like e.g. 'Europe/Warsaw'.") +@click.option( + "--timezone", + help="Time zone for start and stop options." + " Must be a valid IANA identifier like e.g. 'Europe/Warsaw'.", +) @click.pass_obj def query( obj: _Context, diff --git a/examples/suggest_categories.py b/examples/suggest_categories.py index 4e37999..d6fbf46 100644 --- a/examples/suggest_categories.py +++ b/examples/suggest_categories.py @@ -13,7 +13,6 @@ import aw_client from aw_client import queries - # set up client awc = aw_client.ActivityWatchClient("test") diff --git a/examples/working_hours.py b/examples/working_hours.py index df4e37c..a6d10c5 100644 --- a/examples/working_hours.py +++ b/examples/working_hours.py @@ -19,7 +19,6 @@ from aw_transform import flood from tabulate import tabulate - OUTPUT_HTML = os.environ.get("OUTPUT_HTML", "").lower() == "true" td1d = timedelta(days=1) From 4dae34cc75b76fb166ab2e2c8c50117542c0b65c Mon Sep 17 00:00:00 2001 From: TimeToBuildBob Date: Mon, 23 Feb 2026 06:14:32 +0000 Subject: [PATCH 3/3] ci: update examples workflow to Python 3.10 and bump action versions Python 3.9 is no longer available in the GitHub Actions runner toolcache. Update to 3.10 which is the oldest supported version available. Also bump actions/checkout to v3 and actions/setup-python to v4. --- .github/workflows/examples.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 1dd8fc8..617d321 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -15,15 +15,15 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python_version: [3.9] + python_version: ["3.10"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }}