Skip to content

Commit 149f6e5

Browse files
committed
fix(ci): resolve mypy and innerHTML static-check failures
- plan_edit.py: default extra_subtitles/extra_audio to () when the key is absent in the payload, matching the non-optional PlanEdit field type and satisfying mypy (previously _payload_paths could return None) - app.js: replace innerHTML-based SVG construction with createElementNS in the drag handle and iconSvg helpers, so the dynamic renderer complies with the test_gui_dynamic_rendering_does_not_use_inner_html static check
1 parent d6914f9 commit 149f6e5

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

plexmuxy/plan_edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def plan_edits_from_payload(payload: Any) -> dict[Path, PlanEdit]:
7171
item.get("subtitle_metadata_overrides", []), index
7272
),
7373
external_track_order=_payload_strings(item.get("external_track_order", []), index),
74-
extra_subtitles=_payload_paths(item, "extra_subtitles", index),
75-
extra_audio=_payload_paths(item, "extra_audio", index),
74+
extra_subtitles=_payload_paths(item, "extra_subtitles", index) or (),
75+
extra_audio=_payload_paths(item, "extra_audio", index) or (),
7676
)
7777
return result
7878

plexmuxy_gui/static/app.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,20 @@ function makeDraggable(li, list, edit, selectedKey) {
15961596
const handle = element("span", "track-drag-handle");
15971597
handle.title = t("plan.dragToReorder");
15981598
handle.setAttribute("aria-hidden", "true");
1599-
handle.innerHTML = '<svg viewBox="0 0 10 16" width="10" height="16" fill="currentColor" aria-hidden="true"><circle cx="2.5" cy="3" r="1.5"/><circle cx="2.5" cy="8" r="1.5"/><circle cx="2.5" cy="13" r="1.5"/><circle cx="7.5" cy="3" r="1.5"/><circle cx="7.5" cy="8" r="1.5"/><circle cx="7.5" cy="13" r="1.5"/></svg>';
1599+
const handleSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1600+
handleSvg.setAttribute("viewBox", "0 0 10 16");
1601+
handleSvg.setAttribute("width", "10");
1602+
handleSvg.setAttribute("height", "16");
1603+
handleSvg.setAttribute("fill", "currentColor");
1604+
handleSvg.setAttribute("aria-hidden", "true");
1605+
[[2.5, 3], [2.5, 8], [2.5, 13], [7.5, 3], [7.5, 8], [7.5, 13]].forEach(([cx, cy]) => {
1606+
const dot = document.createElementNS("http://www.w3.org/2000/svg", "circle");
1607+
dot.setAttribute("cx", String(cx));
1608+
dot.setAttribute("cy", String(cy));
1609+
dot.setAttribute("r", "1.5");
1610+
handleSvg.appendChild(dot);
1611+
});
1612+
handle.appendChild(handleSvg);
16001613
handle.setAttribute("draggable", "true");
16011614
handle.addEventListener("dragstart", (e) => {
16021615
e.dataTransfer.effectAllowed = "move";
@@ -1971,7 +1984,14 @@ function decisionReasonSpan(reason) {
19711984
return element("span", "decision-reason", localizeEnum("track.reason", reason));
19721985
}
19731986
function element(tag, className = "", text = null) { const node = document.createElement(tag); if (className) node.className = className; if (text !== null) node.textContent = String(text); return node; }
1974-
function iconSvg(name) { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("class", "icon"); svg.innerHTML = `<use href="#${name}"></use>`; return svg; }
1987+
function iconSvg(name) {
1988+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1989+
svg.setAttribute("class", "icon");
1990+
const use = document.createElementNS("http://www.w3.org/2000/svg", "use");
1991+
use.setAttribute("href", `#${name}`);
1992+
svg.appendChild(use);
1993+
return svg;
1994+
}
19751995
function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }
19761996
function empty(container, number, title, detail) {
19771997
clear(container); container.className = "stack empty-state";

0 commit comments

Comments
 (0)