Commit 1a2ecbe2 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Simplifying ValidateHelper

parent 2a8cabca
...@@ -82,20 +82,14 @@ class ValidatorHelper: ...@@ -82,20 +82,14 @@ class ValidatorHelper:
sc_info = cls.schema_dict[schema_code] sc_info = cls.schema_dict[schema_code]
# Build checks configuration # Build checks configuration
checks = ['structure', 'schema']
pre_checks_conf = None pre_checks_conf = None
if 'goodtables_checks' in sc_info: if 'goodtables_checks' in sc_info:
c_checks = sc_info['goodtables_checks'] pre_checks_conf = sc_info['goodtables_checks'].get('pre_checks')
if 'custom_checks' in c_checks:
for check_conf in c_checks['custom_checks']:
checks.append({check_conf['name']: check_conf['params']})
pre_checks_conf = c_checks.get('pre_checks')
return validate( return validate(
source=args['source'], source=args['source'],
schema=sc_info['schema'], schema=schema_code,
pre_checks_conf=pre_checks_conf, pre_checks_conf=pre_checks_conf,
force_strings=True, force_strings=True,
**{k: v for k, v in args.items() if k != 'source'} **{k: v for k, v in args.items() if k != 'source'}
) )
Supports Markdown
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