From 16e75d6b4df6cb5255a650dac97ae557e4dbfc6d Mon Sep 17 00:00:00 2001 From: Eddie Roman Date: Wed, 22 Jul 2026 21:33:51 +0300 Subject: [PATCH 1/2] [et_xmlfile] Complete the writer_cm annotation --- stubs/et_xmlfile/et_xmlfile/xmlfile.pyi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi b/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi index 9e1f55e25689..4e5372e4bbb6 100644 --- a/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi +++ b/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi @@ -1,8 +1,7 @@ import types import xml.etree.ElementTree as ET -from _typeshed import Incomplete from collections.abc import Generator -from contextlib import contextmanager +from contextlib import _GeneratorContextManager, contextmanager from typing import Any class LxmlSyntaxError(Exception): ... @@ -27,7 +26,7 @@ class _IncrementalFileWriter: class xmlfile: encoding: str - writer_cm: Incomplete + writer_cm: _GeneratorContextManager[tuple[ET._FileWrite, str]] | None def __init__( self, output_file: ET._FileWrite, buffered: bool = False, encoding: str = "utf-8", close: bool = False ) -> None: ... From 90ba988d797f03508c1e5147eb6c91691f61a53b Mon Sep 17 00:00:00 2001 From: Eddie Roman Date: Thu, 23 Jul 2026 17:12:13 +0300 Subject: [PATCH 2/2] Type the yielded writer as a plain callable --- stubs/et_xmlfile/et_xmlfile/xmlfile.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi b/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi index 4e5372e4bbb6..ffa96d78670c 100644 --- a/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi +++ b/stubs/et_xmlfile/et_xmlfile/xmlfile.pyi @@ -1,6 +1,6 @@ import types import xml.etree.ElementTree as ET -from collections.abc import Generator +from collections.abc import Callable, Generator from contextlib import _GeneratorContextManager, contextmanager from typing import Any @@ -9,7 +9,7 @@ class LxmlSyntaxError(Exception): ... class _IncrementalFileWriter: global_nsmap: dict[str, str] is_html: bool - def __init__(self, output_file: ET._FileWrite) -> None: ... + def __init__(self, output_file: Callable[[str], object]) -> None: ... @contextmanager def element( self, @@ -26,7 +26,7 @@ class _IncrementalFileWriter: class xmlfile: encoding: str - writer_cm: _GeneratorContextManager[tuple[ET._FileWrite, str]] | None + writer_cm: _GeneratorContextManager[tuple[Callable[[str], object], str]] | None def __init__( self, output_file: ET._FileWrite, buffered: bool = False, encoding: str = "utf-8", close: bool = False ) -> None: ...