Skip to content

Commit 46614d8

Browse files
committed
!squash more validator
1 parent 5c075a3 commit 46614d8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/vcspull/validator.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pathlib
12
import typing as t
23

34
from vcspull.types import RawConfigDict
@@ -7,4 +8,25 @@
78

89

910
def is_valid_config(config: t.Dict[str, t.Any]) -> "TypeGuard[RawConfigDict]":
11+
if not isinstance(config, dict):
12+
return False
13+
14+
for k, v in config.items():
15+
if k is None or v is None:
16+
return False
17+
18+
if not isinstance(k, str) and not isinstance(k, pathlib.Path):
19+
return False
20+
21+
if not isinstance(v, dict):
22+
return False
23+
24+
for repo_name, repo in v.items():
25+
if not isinstance(repo, (str, dict, pathlib.Path)):
26+
return False
27+
28+
if isinstance(repo, dict):
29+
if "url" not in repo and "repo" not in repo:
30+
return False
31+
1032
return True

0 commit comments

Comments
 (0)