Skip to content

Commit

Permalink
revert: Stop checking stuff that never happen
Browse files Browse the repository at this point in the history
Just assert the state.
  • Loading branch information
ewuerger committed Aug 27, 2024
1 parent 0c189aa commit 70a365f
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions capella2polarion/connectors/polarion_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,10 @@ def get_missing_link_ids(
) -> dict[str, polarion_api.WorkItemLink]:
"""Return an ID-Link dict of links present in left and not in right."""
left_id_map = {
CapellaPolarionWorker._get_link_id(link): link
for link in CapellaPolarionWorker._filter_all_link_ids(left)
CapellaPolarionWorker._get_link_id(link): link for link in left
}
right_id_map = {
CapellaPolarionWorker._get_link_id(link): link
for link in CapellaPolarionWorker._filter_all_link_ids(right)
CapellaPolarionWorker._get_link_id(link): link for link in right
}
return {
lid: left_id_map[lid]
Expand All @@ -428,28 +426,10 @@ def get_missing_link_ids(
def _get_link_id(link: polarion_api.WorkItemLink) -> str:
secondary_id = link.secondary_work_item_id
if link.secondary_work_item_project:
assert link.secondary_work_item_project is not None
secondary_id = f"{link.secondary_work_item_project}/{secondary_id}"
return "/".join((link.primary_work_item_id, link.role, secondary_id))

@staticmethod
def _filter_all_link_ids(
links: cabc.Iterable[polarion_api.WorkItemLink],
) -> cabc.Iterator[polarion_api.WorkItemLink]:
for link in links:
if link.primary_work_item_id is None:
logger.error( # type: ignore[unreachable]
"Found Work Item Link without source ID: %r", link
)
continue

if link.secondary_work_item_id is None:
logger.error( # type: ignore[unreachable]
"Found Work Item Link without target ID: %r", link
)
continue

yield link

def compare_and_update_work_items(
self, converter_session: data_session.ConverterSession
) -> None:
Expand Down

0 comments on commit 70a365f

Please sign in to comment.