From dce72af9c1a01cdc03c122d4ac2fdfe3adde5f04 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Fri, 6 Sep 2024 15:17:44 +0200 Subject: [PATCH] ci: Please Pylint --- .../converters/document_renderer.py | 1 + .../converters/text_work_item_provider.py | 8 +++---- pyproject.toml | 1 + tests/test_documents.py | 6 +---- tests/test_elements.py | 24 ------------------- 5 files changed, 7 insertions(+), 33 deletions(-) diff --git a/capella2polarion/converters/document_renderer.py b/capella2polarion/converters/document_renderer.py index 80610212..5b868b50 100644 --- a/capella2polarion/converters/document_renderer.py +++ b/capella2polarion/converters/document_renderer.py @@ -118,6 +118,7 @@ def __insert_work_item( session.inserted_work_items.append(wi) if self._is_external_document(session): + # pylint: disable-next=line-too-long return polarion_html_helper.POLARION_WORK_ITEM_DOCUMENT_PROJECT.format( pid=wi.id, lid=layout_index, diff --git a/capella2polarion/converters/text_work_item_provider.py b/capella2polarion/converters/text_work_item_provider.py index a75e022a..cbf14934 100644 --- a/capella2polarion/converters/text_work_item_provider.py +++ b/capella2polarion/converters/text_work_item_provider.py @@ -95,19 +95,19 @@ def insert_text_work_items( "paragraph", document.rendering_layouts, self.text_work_item_type ) html_fragments = html_helper.ensure_fragments( - document.home_page_content.value + document.home_page_content.value or "" ) - new_content = [] + new_content: list[html.HtmlElement | str] = [] last_match = -1 for index, element in enumerate(html_fragments): if not isinstance(element, html.HtmlElement): continue if element.tag == "workitem": - new_content += html_fragments[last_match + 1 : index] + new_content.extend(html_fragments[last_match + 1 : index]) last_match = index if work_item := self.new_text_work_items.get( - element.get("id") + element.get("id", "") ): new_content.append( html.fromstring( diff --git a/pyproject.toml b/pyproject.toml index 197b6e30..96c47c01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,6 +169,7 @@ disable = [ "unbalanced-tuple-unpacking", "undefined-variable", "unexpected-keyword-arg", + "unsubscriptable-object", ] enable = [ "c-extension-no-member", diff --git a/tests/test_documents.py b/tests/test_documents.py index 93c4b1cb..a9ddf05a 100644 --- a/tests/test_documents.py +++ b/tests/test_documents.py @@ -546,11 +546,7 @@ def test_render_all_documents_overwrite_headings_layouts( def test_full_authority_document_config(): - with open( - FULL_AUTHORITY_CONFIG, - "r", - encoding="utf-8", - ) as f: + with open(FULL_AUTHORITY_CONFIG, "r", encoding="utf-8") as f: conf = document_config.read_config_file(f) assert len(conf.full_authority) == 2 diff --git a/tests/test_elements.py b/tests/test_elements.py index 60635b2f..cf2305df 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -886,14 +886,6 @@ def test_update_work_items_filters_work_items_with_same_checksum( ) ] ) - base_object.mc.converter_session["uuid1"].work_item = ( - data_models.CapellaWorkItem( - id="Obj-1", - uuid_capella="uuid1", - status="open", - type="fakeModelObject", - ) - ) del base_object.mc.converter_session["uuid2"] @@ -919,14 +911,6 @@ def test_update_work_items_same_checksum_force( ) ] ) - base_object.mc.converter_session["uuid1"].work_item = ( - data_models.CapellaWorkItem( - id="Obj-1", - uuid_capella="uuid1", - status="open", - type="fakeModelObject", - ) - ) del base_object.mc.converter_session["uuid2"] @@ -972,14 +956,6 @@ def test_update_links(base_object: BaseObjectContainer): ) ] ) - base_object.mc.converter_session["uuid1"].work_item = ( - data_models.CapellaWorkItem( - id="Obj-1", - uuid_capella="uuid1", - status="open", - type="fakeModelObject", - ) - ) base_object.mc.converter_session["uuid2"].work_item = ( data_models.CapellaWorkItem( id="Obj-2",