From b9e32a1a27c1c140e6970f590d110e7e9ecfeeb0 Mon Sep 17 00:00:00 2001 From: Michael Harbarth Date: Wed, 16 Oct 2024 17:25:38 +0200 Subject: [PATCH] ci: fix mypy and pylint --- .pre-commit-config.yaml | 2 +- capella2polarion/connectors/polarion_worker.py | 2 -- capella2polarion/data_models.py | 4 ++-- tests/test_elements.py | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0934cde..c1a6172 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,7 +57,7 @@ repos: - capellambse==0.6.6 - click - jinja2 - - polarion-rest-api-client==1.1.3 + - polarion-rest-api-client==1.2.0 - pydantic - types-requests - types-PyYAML diff --git a/capella2polarion/connectors/polarion_worker.py b/capella2polarion/connectors/polarion_worker.py index 22886ed..352d874 100644 --- a/capella2polarion/connectors/polarion_worker.py +++ b/capella2polarion/connectors/polarion_worker.py @@ -87,7 +87,6 @@ def __init__( delete_status=( "deleted" if self.polarion_params.delete_work_items else None ), - add_work_item_checksum=True, ) self._additional_clients: dict[str, polarion_api.ProjectClient] = {} self.check_client() @@ -104,7 +103,6 @@ def _get_client( delete_status=( "deleted" if self.polarion_params.delete_work_items else None ), - add_work_item_checksum=True, ) if not client.exists(): raise KeyError(f"Miss Polarion project with id {project_id}") diff --git a/capella2polarion/data_models.py b/capella2polarion/data_models.py index 6678492..7df2b1f 100644 --- a/capella2polarion/data_models.py +++ b/capella2polarion/data_models.py @@ -7,7 +7,6 @@ import dataclasses import hashlib import json -import typing as t import polarion_rest_api_client as polarion_api @@ -24,7 +23,9 @@ class CapellaWorkItem(polarion_api.WorkItem): def clear_attributes(self): """Clear all additional attributes except the checksum.""" + # pylint: disable=attribute-defined-outside-init self.additional_attributes = {"checksum": self.checksum} + # pylint: enable=attribute-defined-outside-init def calculate_checksum(self) -> str: """Calculate and return a checksum for this WorkItem. @@ -57,7 +58,6 @@ def calculate_checksum(self) -> str: data = dict(sorted(data.items())) converted = json.dumps(data).encode("utf8") - # pylint: disable=attribute-defined-outside-init self.checksum = json.dumps( {"__C2P__WORK_ITEM": hashlib.sha256(converted).hexdigest()} | dict(sorted(attachment_checksums.items())) diff --git a/tests/test_elements.py b/tests/test_elements.py index 17b6887..99ef35b 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -1648,8 +1648,8 @@ def test_diagram(model: capellambse.MelodyModel): "uuid_capella": TEST_ACTOR_UUID, "description": polarion_api.HtmlContent( markupsafe.Markup( - "

Principal of Hogwarts, wearer of the elder wand " - "and greatest mage of all time.

\n" + "

Principal of Hogwarts, wearer of the elder" + " wand and greatest mage of all time.

\n" ) ), },