mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Do not allow None value if we assert they're not None on the next line
This change imply changing the `save_status` parameters order. If you don't like that, I can drop this commit.
This commit is contained in:
parent
c073d55b2f
commit
f194bb0a4c
3 changed files with 7 additions and 9 deletions
|
|
@ -108,8 +108,8 @@ async def collections_for_pair(
|
||||||
await _sanity_check_collections(rv, connector=connector)
|
await _sanity_check_collections(rv, connector=connector)
|
||||||
|
|
||||||
save_status(
|
save_status(
|
||||||
status_path,
|
base_path=status_path,
|
||||||
pair.name,
|
pair=pair.name,
|
||||||
data_type="collections",
|
data_type="collections",
|
||||||
data={
|
data={
|
||||||
"collections": list(
|
"collections": list(
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,9 @@ async def metasync_collection(collection, general, *, connector: aiohttp.TCPConn
|
||||||
raise JobFailed
|
raise JobFailed
|
||||||
|
|
||||||
save_status(
|
save_status(
|
||||||
general["status_path"],
|
base_path=general["status_path"],
|
||||||
pair.name,
|
pair=pair.name,
|
||||||
collection.name,
|
|
||||||
data_type="metadata",
|
data_type="metadata",
|
||||||
data=status,
|
data=status,
|
||||||
|
collection=collection.name,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -242,12 +242,10 @@ def manage_sync_status(base_path: str, pair_name: str, collection_name: str):
|
||||||
def save_status(
|
def save_status(
|
||||||
base_path: str,
|
base_path: str,
|
||||||
pair: str,
|
pair: str,
|
||||||
|
data_type: str,
|
||||||
|
data: dict[str, Any],
|
||||||
collection: str | None = None,
|
collection: str | None = None,
|
||||||
data_type: str | None = None,
|
|
||||||
data: dict | None = None,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
assert data_type is not None
|
|
||||||
assert data is not None
|
|
||||||
status_name = get_status_name(pair, collection)
|
status_name = get_status_name(pair, collection)
|
||||||
path = expand_path(os.path.join(base_path, status_name)) + "." + data_type
|
path = expand_path(os.path.join(base_path, status_name)) + "." + data_type
|
||||||
prepare_status_path(path)
|
prepare_status_path(path)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue