Skip to content

Commit

Permalink
ci: Please Pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Sep 6, 2024
1 parent b0cd0d5 commit 637e9d0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
1 change: 1 addition & 0 deletions capella2polarion/converters/document_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions capella2polarion/converters/text_work_item_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion capella2polarion/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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()))
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ disable = [
"unbalanced-tuple-unpacking",
"undefined-variable",
"unexpected-keyword-arg",
"unsubscriptable-object",
]
enable = [
"c-extension-no-member",
Expand Down
6 changes: 1 addition & 5 deletions tests/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions tests/test_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand All @@ -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"]

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 637e9d0

Please sign in to comment.