Skip to content

Commit

Permalink
Merge branch 'main' into decrease-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger authored Oct 25, 2023
2 parents 8a44a03 + fe22b4c commit 48eea58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ repos:
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.2
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies:
Expand All @@ -47,7 +47,7 @@ repos:
additional_dependencies:
- pydocstyle[toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
Expand Down Expand Up @@ -97,10 +97,10 @@ repos:
- --comment-style
- "..| |"
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
rev: v2.1.0
hooks:
- id: reuse
- repo: https://github.com/qoomon/git-conventional-commits
rev: v2.6.4
rev: v2.6.5
hooks:
- id: conventional-commits
10 changes: 7 additions & 3 deletions capella2polarion/elements/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _generic_work_item(
) -> CapellaWorkItem:
xtype = ctx["POLARION_TYPE_MAP"].get(obj.uuid, type(obj).__name__)
raw_description = getattr(obj, "description", markupsafe.Markup(""))
uuids, value = _sanitize_description(raw_description, ctx)
uuids, value = _sanitize_description(obj, raw_description, ctx)
ctx.setdefault("DESCR_REFERENCES", {})[obj.uuid] = uuids
return CapellaWorkItem(
type=helpers.resolve_element_type(xtype),
Expand All @@ -124,7 +124,7 @@ def _generic_work_item(


def _sanitize_description(
descr: markupsafe.Markup, ctx: dict[str, t.Any]
obj: common.GenericElement, descr: markupsafe.Markup, ctx: dict[str, t.Any]
) -> tuple[list[str], markupsafe.Markup]:
referenced_uuids: list[str] = []
replaced_markup = RE_DESCR_LINK_PATTERN.sub(
Expand All @@ -146,7 +146,11 @@ def repair_images(node: etree._Element) -> None:
b64_img = base64.b64encode(img.read()).decode("utf8")
node.attrib["src"] = f"data:{mime_type};base64,{b64_img}"
except FileNotFoundError:
logger.error("Inline image can't be found from %r", file_path)
logger.error(
"Inline image can't be found from %r for %r",
file_path,
obj._short_repr_(),
)

repaired_markup = chelpers.process_html_fragments(
replaced_markup, repair_images
Expand Down

0 comments on commit 48eea58

Please sign in to comment.