mirror of https://github.com/explosion/spaCy.git
20 lines
506 B
Python
20 lines
506 B
Python
import json
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def validate_json(document):
|
|
universe_file = Path(document)
|
|
with universe_file.open() as f:
|
|
universe_data = json.load(f)
|
|
for entry in universe_data["resources"]:
|
|
if "github" in entry:
|
|
assert not re.match(
|
|
r"^(http:)|^(https:)", entry["github"]
|
|
), "Github field should be user/repo, not a url"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
validate_json(str(sys.argv[1]))
|