Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Validata
Validata Core
Commits
49830fce
Commit
49830fce
authored
Dec 15, 2020
by
Pierre Dittgen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix structure_warnings
parent
ff95c92a
Pipeline
#2409
failed with stage
in 2 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
validata_core/structure_warnings.py
validata_core/structure_warnings.py
+12
-11
No files found.
validata_core/structure_warnings.py
View file @
49830fce
...
...
@@ -10,12 +10,13 @@
"""
from
dataclasses
import
dataclass
@
dataclass
class
StructureWarning
:
code
:
str
name
:
str
message
:
str
field_name
:
str
=
""
def
structure_warning
(
code
:
str
,
name
:
str
,
message
:
str
,
field_name
:
str
=
""
):
return
{
"code"
:
code
,
"name"
:
name
,
"message"
:
message
,
"field_name"
:
field_name
}
def
iter_structure_warnings
(
source_header
,
required_field_names
,
schema
):
...
...
@@ -26,7 +27,7 @@ def iter_structure_warnings(source_header, required_field_names, schema):
for
field_name
in
schema_field_names
:
if
field_name
not
in
source_header
and
field_name
not
in
required_field_names
:
# yield MissingHeaderWarning(field_name) # extra fields
yield
S
tructure
W
arning
(
yield
s
tructure
_w
arning
(
"missing-header-warn"
,
"colonne manquante"
,
f
"La colonne `
{
field_name
}
` est absente du fichier"
,
...
...
@@ -35,15 +36,15 @@ def iter_structure_warnings(source_header, required_field_names, schema):
for
h
in
source_header
:
if
h
not
in
schema_field_names
:
yield
S
tructure
W
arning
(
yield
s
tructure
_w
arning
(
"extra-header-warn"
,
"colonne surnuméraire"
,
f
"La colonne `
{
field_name
}
` n'est pas définie dans le schéma"
,
field_name
,
f
"La colonne `
{
h
}
` n'est pas définie dans le schéma"
,
h
,
)
if
set
(
source_header
)
==
set
(
schema_field_names
)
and
source_header
!=
schema_field_names
:
yield
S
tructure
W
arning
(
yield
s
tructure
_w
arning
(
"disordered-header-warn"
,
"colonnes désordonnées"
,
f
"l'ordre des colonnes ne respecte pas celui défini dans le schéma :
{
schema_field_names
!
r
}
"
,
...
...
Write
Preview
Markdown
is supported
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