Skip to content

Commit f194bb0

Browse files
just1602WhyNotHugo
authored andcommitted
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.
1 parent c073d55 commit f194bb0

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

vdirsyncer/cli/discover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ async def collections_for_pair(
108108
await _sanity_check_collections(rv, connector=connector)
109109

110110
save_status(
111-
status_path,
112-
pair.name,
111+
base_path=status_path,
112+
pair=pair.name,
113113
data_type="collections",
114114
data={
115115
"collections": list(

vdirsyncer/cli/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ async def metasync_collection(collection, general, *, connector: aiohttp.TCPConn
164164
raise JobFailed
165165

166166
save_status(
167-
general["status_path"],
168-
pair.name,
169-
collection.name,
167+
base_path=general["status_path"],
168+
pair=pair.name,
170169
data_type="metadata",
171170
data=status,
171+
collection=collection.name,
172172
)

vdirsyncer/cli/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,10 @@ def manage_sync_status(base_path: str, pair_name: str, collection_name: str):
242242
def save_status(
243243
base_path: str,
244244
pair: str,
245+
data_type: str,
246+
data: dict[str, Any],
245247
collection: str | None = None,
246-
data_type: str | None = None,
247-
data: dict | None = None,
248248
) -> None:
249-
assert data_type is not None
250-
assert data is not None
251249
status_name = get_status_name(pair, collection)
252250
path = expand_path(os.path.join(base_path, status_name)) + "." + data_type
253251
prepare_status_path(path)

0 commit comments

Comments
 (0)