Commit 10cfdd39 authored by Christophe Benz's avatar Christophe Benz
Browse files

Rename arguments

parent a7d680be
import importlib.util
import json
import logging
from pathlib import Path
from datetime import datetime
from pathlib import Path
import importlib_resources
import requests
......@@ -102,8 +102,8 @@ def build_checks(goodtables_checks_json):
return pre_checks_conf, checks
def resolve_schema(value, schema_config=None):
"""Return a `tableschema.Schema` instance from `value` which can be either:
def resolve_schema(source, schema_config=None):
"""Return a `tableschema.Schema` instance from `source` which can be either:
- a `pathlib.Path`
- a `str` containing either:
- a file path
......@@ -112,21 +112,21 @@ def resolve_schema(value, schema_config=None):
- a `dict` representing the schema in JSON
- a `tableschema.Schema` instance
"""
if isinstance(value, Path):
value = str(value)
if isinstance(value, str) and schema_config is not None:
# `value` is a SCDL tag (i.e. `scdl-prenoms`)
value = schema_config["schema_json_url"]
schema = Schema(value)
if isinstance(source, Path):
source = str(source)
if isinstance(source, str) and schema_config is not None:
# `source` is a SCDL tag (i.e. `scdl-prenoms`)
source = schema_config["schema_json_url"]
schema = Schema(source)
return schema
def validate(source, schema, checks=None, **options):
def validate(source, schema_source, checks=None, **options):
"""Validate a `source` applying pre-checks and checks.
`schema` is resolved using `resolve_schema`.
"""
schema, pre_checks_conf, checks = load_schema_and_checks(schema, checks)
schema, pre_checks_conf, checks = load_schema_and_checks(schema_source, checks)
schema_descriptor = schema.descriptor
report = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment