Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Validata
Validata Core
Commits
cbedd798
Commit
cbedd798
authored
Mar 24, 2021
by
Pierre Dittgen
Browse files
Adapt error filter based on tags
parent
e6dc8927
Changes
1
Hide whitespace changes
Inline
Side-by-side
validata_core/helpers.py
View file @
cbedd798
...
...
@@ -101,13 +101,17 @@ def _extract_header_and_rows_from_frictionless_source(source, **source_options):
return
rows
[
0
],
rows
[
1
:]
BODY_TAGS
=
frozenset
([
"#body"
,
"#cell"
,
"#content"
,
"#row"
,
"#table"
])
STRUCTURE_TAGS
=
frozenset
([
"#head"
,
"#structure"
])
def
is_body_error
(
err
:
Union
[
frictionless
.
errors
.
Error
,
Dict
])
->
bool
:
"""Classify the given error as 'body error' according to its tags."""
tags
=
err
.
tags
if
isinstance
(
err
,
frictionless
.
errors
.
Error
)
else
err
[
"tags"
]
return
"#body"
in
tags
or
"#content"
in
tags
return
bool
(
BODY_TAGS
&
set
(
tags
))
def
is_structure_error
(
err
:
Union
[
frictionless
.
errors
.
Error
,
Dict
])
->
bool
:
"""Classify the given error as 'structure error' according to its tags."""
tags
=
err
.
tags
if
isinstance
(
err
,
frictionless
.
errors
.
Error
)
else
err
[
"tags"
]
return
"#head"
in
tags
or
"#structure"
in
tags
return
bool
(
STRUCTURE_TAGS
&
set
(
tags
))
Pierre Dittgen
@pdi
mentioned in issue
validata-ui#89 (closed)
·
Mar 24, 2021
mentioned in issue
validata-ui#89 (closed)
mentioned in issue validata-ui#89
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment