diff --git a/vdirsyncer/cli/discover.py b/vdirsyncer/cli/discover.py index e18aa20..2ddb0a3 100644 --- a/vdirsyncer/cli/discover.py +++ b/vdirsyncer/cli/discover.py @@ -57,7 +57,7 @@ async def collections_for_pair( cache_key = _get_collections_cache_key(pair) if from_cache: rv = load_status(status_path, pair.name, data_type="collections") - if rv and rv.get("cache_key", None) == cache_key: + if rv.get("cache_key", None) == cache_key: return list( _expand_collections_cache( rv["collections"], pair.config_a, pair.config_b diff --git a/vdirsyncer/cli/tasks.py b/vdirsyncer/cli/tasks.py index 8aa2b43..84f8290 100644 --- a/vdirsyncer/cli/tasks.py +++ b/vdirsyncer/cli/tasks.py @@ -142,11 +142,11 @@ async def metasync_collection(collection, general, *, connector: aiohttp.TCPConn try: cli_logger.info(f"Metasyncing {status_name}") - status = ( - load_status( - general["status_path"], pair.name, collection.name, data_type="metadata" - ) - or {} + status = load_status( + general["status_path"], + pair.name, + collection.name, + data_type="metadata", ) a = await storage_instance_from_config(collection.config_a, connector=connector) diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index 3a1bc98..9f5992f 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -6,6 +6,7 @@ import importlib import json import os import sys +from typing import Any import aiohttp import click @@ -186,11 +187,11 @@ def load_status( base_path: str, pair: str, collection: str | None = None, - data_type: str | None = None -) -> dict | None: + data_type: str | None = None, +) -> dict[str, Any]: path = get_status_path(base_path, pair, collection, data_type) if not os.path.exists(path): - return None + return {} assert_permissions(path, STATUS_PERMISSIONS) with open(path) as f: