From 2ae924e8dfe88a746ff8ad8af46c2834ad5b294d Mon Sep 17 00:00:00 2001 From: Antoine Augusti Date: Fri, 24 Apr 2020 13:56:10 -0400 Subject: [PATCH] Pass options to Inspector's init --- validata_core/__init__.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/validata_core/__init__.py b/validata_core/__init__.py index b9358c9..65fff44 100644 --- a/validata_core/__init__.py +++ b/validata_core/__init__.py @@ -339,11 +339,21 @@ def validate(source, schema, with_repair=True, **options): if custom_checks_config: for custom_check_conf in custom_checks_config: checks.append({custom_check_conf['name']: custom_check_conf['params']}) - inspector = goodtables.Inspector( - checks=checks, - skip_checks=['non-matching-header', 'extra-header', 'missing-header'], - row_limit=VALIDATA_MAX_ROWS, - ) + + inspector_options_keys = [ + 'checks', 'skip_checks', 'infer_schema', + 'infer_fields', 'order_fields', 'error_limit', + 'table_limit', 'row_limit', + ] + inspector_options = { + **{ + 'checks': checks, + 'skip_checks': ['non-matching-header', 'extra-header', 'missing-header'], + 'row_limit': VALIDATA_MAX_ROWS, + }, + **{k: v for k, v in options.items() if k in inspector_options_keys} + } + inspector = goodtables.Inspector(**inspector_options) options = {**base_options} if with_repair: -- GitLab