Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos0000 committed Jan 24, 2024
1 parent 18be8ed commit 9261199
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ted_sws/core/model/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class NormalisedMetadata(Metadata):
eforms_subtype: str
xsd_version: str
published_in_cellar_counter: int = Field(default=0)
is_eForm: Optional[bool]
is_eform: Optional[bool] = False


class NormalisedMetadataView(Metadata):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from ted_sws.notice_metadata_processor.adapters.xpath_registry import EformsXPathRegistry, DefaultXPathRegistry
from ted_sws.notice_metadata_processor.model.metadata import ExtractedMetadata

MANIFESTATION_NAMESPACE_KEY = "manifestation_ns"
NUTS_NAMESPACE_KEY = "nuts"


class NoticeMetadataExtractorABC(abc.ABC):

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

namespaces["manifestation_ns"] = namespaces.pop("") if "" in namespaces.keys() else ""
namespaces[MANIFESTATION_NAMESPACE_KEY] = namespaces.pop("") if "" in namespaces.keys() else ""

tmp_dict = namespaces.copy()
items = tmp_dict.items()
for key, value in items:
if value.endswith("nuts"):
namespaces["nuts"] = namespaces.pop(key)
if value.endswith(NUTS_NAMESPACE_KEY):
namespaces[NUTS_NAMESPACE_KEY] = namespaces.pop(key)

if "nuts" not in namespaces.keys():
namespaces.update({"nuts": "no_nuts"})
namespaces.update({NUTS_NAMESPACE_KEY: "no_nuts"})

return namespaces
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
DEADLINE_DATE_KEY = "deadline_for_submission"
NOTICE_TYPE_KEY = "notice_type"
XSD_VERSION_KEY = "xsd_version"
IS_EFORM_KEY = "is_eForm"
IS_EFORM_KEY = "is_eform"
ENGLISH_LANGUAGE_TAG = "EN"
mapping_registry = MappingFilesRegistry()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def a_notice(normalised_notice):
@given('the notice is with form number F03')
def the_notice_is_with_form_number_f03(normalised_notice):
"""the notice is with form number F03."""
print(normalised_notice.normalised_metadata)
assert normalised_notice.normalised_metadata.form_number == "F03"


Expand Down

0 comments on commit 9261199

Please sign in to comment.