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:
Justin ! 2023-08-23 00:03:48 -04:00 committed by Hugo
parent c073d55b2f
commit f194bb0a4c
3 changed files with 7 additions and 9 deletions

View file

@ -108,8 +108,8 @@ async def collections_for_pair(
await _sanity_check_collections(rv, connector=connector)
save_status(
status_path,
pair.name,
base_path=status_path,
pair=pair.name,
data_type="collections",
data={
"collections": list(

View file

@ -164,9 +164,9 @@ async def metasync_collection(collection, general, *, connector: aiohttp.TCPConn
raise JobFailed
save_status(
general["status_path"],
pair.name,
collection.name,
base_path=general["status_path"],
pair=pair.name,
data_type="metadata",
data=status,
collection=collection.name,
)

View file

@ -242,12 +242,10 @@ def manage_sync_status(base_path: str, pair_name: str, collection_name: str):
def save_status(
base_path: str,
pair: str,
data_type: str,
data: dict[str, Any],
collection: str | None = None,
data_type: str | None = None,
data: dict | None = None,
) -> None:
assert data_type is not None
assert data is not None
status_name = get_status_name(pair, collection)
path = expand_path(os.path.join(base_path, status_name)) + "." + data_type
prepare_status_path(path)