Skip to content

Commit ec55701

Browse files
sciyoshiclaude
andcommitted
fix: resolve ty type checking errors
- Change _render_spec and _suspicious_attributes to accept Mapping[str, Any] instead of dict[str, Any] for block_arrays_in parameter, matching the Attrs type alias (Mapping-based) - Fix test lambda signature to match MarkSpec.toDOM (2 params) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c220c03 commit ec55701

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

prosemirror/model/to_dom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def render_spec(
157157
cls,
158158
structure: HTMLOutputSpec,
159159
xml_ns: str | None = None,
160-
block_arrays_in: dict[str, Any] | None = None,
160+
block_arrays_in: Mapping[str, Any] | None = None,
161161
) -> tuple[HTMLNode, Element | None]:
162162
return _render_spec(structure, xml_ns, block_arrays_in)
163163

@@ -183,7 +183,7 @@ def marks_from_schema(
183183
return gather_to_dom(schema.marks)
184184

185185

186-
def _suspicious_attributes(attrs: dict[str, Any]) -> list[Any] | None:
186+
def _suspicious_attributes(attrs: Mapping[str, Any]) -> list[Any] | None:
187187
result: list[Any] | None = None
188188

189189
def scan(value: object) -> None:
@@ -208,7 +208,7 @@ def scan(value: object) -> None:
208208
def _render_spec(
209209
structure: HTMLOutputSpec,
210210
xml_ns: str | None = None,
211-
block_arrays_in: dict[str, Any] | None = None,
211+
block_arrays_in: Mapping[str, Any] | None = None,
212212
) -> tuple[HTMLNode, Element | None]:
213213
if isinstance(structure, str):
214214
return html.escape(structure), None

tests/prosemirror_model/tests/test_dom.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ def test_can_temporary_shadow_mark_with_another_configuration():
415415
"marks": {
416416
"color": {
417417
"attrs": {"color": {}},
418-
"toDOM": lambda m: ["span", {"style": f"color: {m.attrs['color']}"}],
418+
"toDOM": lambda m, _inline: [
419+
"span",
420+
{"style": f"color: {m.attrs['color']}"},
421+
],
419422
"parseDOM": [
420423
{"style": "color", "getAttrs": lambda v: {"color": v}},
421424
],

0 commit comments

Comments
 (0)