Skip to content

Commit

Permalink
Merge pull request #358 from nada-ben-ali/NaBe/priority_should_be_giv…
Browse files Browse the repository at this point in the history
…en_to_local_refs

Priority should be given to local refs
  • Loading branch information
andlaus authored Oct 30, 2024
2 parents 98e09b3 + b53bdb0 commit f972a30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion odxtools/diaglayers/diaglayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
# imported references only apply within this specific
# diagnostic layer
extended_odxlinks = copy(odxlinks)
extended_odxlinks.update(imported_links)
extended_odxlinks.update(imported_links, overwrite=False)

self.diag_layer_raw._resolve_odxlinks(extended_odxlinks)
return
Expand Down
7 changes: 5 additions & 2 deletions odxtools/odxlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def resolve_lenient(self,

return None

def update(self, new_entries: Dict[OdxLinkId, Any]) -> None:
def update(self, new_entries: Dict[OdxLinkId, Any], *, overwrite: bool = True) -> None:
"""
Add a bunch of new objects to the ODXLINK database.
Expand All @@ -244,7 +244,10 @@ def update(self, new_entries: Dict[OdxLinkId, Any]) -> None:
if doc_frag not in self._db:
self._db[doc_frag] = {}

self._db[doc_frag][odx_id.local_id] = obj
if overwrite:
self._db[doc_frag][odx_id.local_id] = obj
else:
self._db[doc_frag].setdefault(odx_id.local_id, obj)


@overload
Expand Down

0 comments on commit f972a30

Please sign in to comment.