Skip to content

Commit 6bc00e6

Browse files
authored
Merge pull request #203 from ansforge/feature/parser/nomenclature-management
Feature/Mise à jour de la gestion des nomenclatures
2 parents 9a993cf + 69ca8b9 commit 6bc00e6

File tree

82 files changed

+165
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+165
-135
lines changed

csv_parser/csv_parser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class Color:
4848
HEADER_LINE = 7 # ligne avec les en-têtes (ID Excel - 1)
4949

5050
class FormatFlags(StrEnum):
51-
NOMENCLATURE = 'NOMENCLATURE: '
52-
ENUM = 'ENUM: '
53-
REGEX = 'REGEX: '
51+
NOMENCLATURE = 'NOMENCLATURE'
52+
ENUM = 'ENUM'
53+
REGEX = 'REGEX'
5454

5555

5656
def get_params_from_sheet(sheet):
@@ -84,7 +84,7 @@ def get_params_from_sheet(sheet):
8484

8585
def get_nomenclature(elem):
8686
# filename to target (.csv format)
87-
nomenclature_name = elem['Détails de format'][len(FormatFlags.NOMENCLATURE):]
87+
nomenclature_name = elem['Détails de format'][elem['Détails de format'].index(':')+1:].strip()
8888
path_file = ''
8989
nomenclature_files = os.listdir(os.path.join("..", "nomenclature_parser", "out", "latest", "csv"))
9090
for filename in nomenclature_files:
@@ -498,7 +498,7 @@ def type_matching(child):
498498
return 'string', r'^tel:([#\+\*]|37000|00+)?[0-9]{2,15}$', None
499499
else:
500500
if has_format_details(child, FormatFlags.REGEX):
501-
return typeName, child['Détails de format'][len(FormatFlags.REGEX):], None
501+
return typeName, child['Détails de format'][child['Détails de format'].index(':')+1:].strip(), None
502502
else:
503503
return typeName, None, None
504504

@@ -532,7 +532,7 @@ def add_field_child_property(parent, child, definitions):
532532
if format is not None:
533533
childDetails['format'] = format
534534
if has_format_details(child, FormatFlags.ENUM):
535-
childDetails['enum'] = child['Détails de format'][len(FormatFlags.ENUM):].split(', ')
535+
childDetails['enum'] = child['Détails de format'][child['Détails de format'].index(':')+1:].strip().split(', ')
536536
# key word nomenclature trigger search over nomenclature folder for matching file
537537
if has_format_details(child, FormatFlags.NOMENCLATURE):
538538
childDetails['enum'] = get_nomenclature(child)
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)