Skip to content

Commit 9261199

Browse files
committed
review changes
1 parent 18be8ed commit 9261199

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

ted_sws/core/model/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class NormalisedMetadata(Metadata):
8181
eforms_subtype: str
8282
xsd_version: str
8383
published_in_cellar_counter: int = Field(default=0)
84-
is_eForm: Optional[bool]
84+
is_eform: Optional[bool] = False
8585

8686

8787
class NormalisedMetadataView(Metadata):

ted_sws/notice_metadata_processor/adapters/notice_metadata_extractor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from ted_sws.notice_metadata_processor.adapters.xpath_registry import EformsXPathRegistry, DefaultXPathRegistry
99
from ted_sws.notice_metadata_processor.model.metadata import ExtractedMetadata
1010

11+
MANIFESTATION_NAMESPACE_KEY = "manifestation_ns"
12+
NUTS_NAMESPACE_KEY = "nuts"
13+
1114

1215
class NoticeMetadataExtractorABC(abc.ABC):
1316

@@ -443,15 +446,15 @@ def normalised_namespaces_from_xml_manifestation(xml_manifestation: XMLManifesta
443446
namespaces = dict([node for _, node in ET.iterparse(source=StringIO(xml_manifestation.object_data),
444447
events=['start-ns'])])
445448

446-
namespaces["manifestation_ns"] = namespaces.pop("") if "" in namespaces.keys() else ""
449+
namespaces[MANIFESTATION_NAMESPACE_KEY] = namespaces.pop("") if "" in namespaces.keys() else ""
447450

448451
tmp_dict = namespaces.copy()
449452
items = tmp_dict.items()
450453
for key, value in items:
451-
if value.endswith("nuts"):
452-
namespaces["nuts"] = namespaces.pop(key)
454+
if value.endswith(NUTS_NAMESPACE_KEY):
455+
namespaces[NUTS_NAMESPACE_KEY] = namespaces.pop(key)
453456

454457
if "nuts" not in namespaces.keys():
455-
namespaces.update({"nuts": "no_nuts"})
458+
namespaces.update({NUTS_NAMESPACE_KEY: "no_nuts"})
456459

457460
return namespaces

ted_sws/notice_metadata_processor/adapters/notice_metadata_normaliser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
DEADLINE_DATE_KEY = "deadline_for_submission"
3737
NOTICE_TYPE_KEY = "notice_type"
3838
XSD_VERSION_KEY = "xsd_version"
39-
IS_EFORM_KEY = "is_eForm"
39+
IS_EFORM_KEY = "is_eform"
4040
ENGLISH_LANGUAGE_TAG = "EN"
4141
mapping_registry = MappingFilesRegistry()
4242

tests/features/notice_metadata_processor/test_notice_eligibility.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def a_notice(normalised_notice):
5555
@given('the notice is with form number F03')
5656
def the_notice_is_with_form_number_f03(normalised_notice):
5757
"""the notice is with form number F03."""
58-
print(normalised_notice.normalised_metadata)
5958
assert normalised_notice.normalised_metadata.form_number == "F03"
6059

6160

0 commit comments

Comments
 (0)