11from _typeshed import ReadableBuffer , SupportsRead , SupportsWrite
2- from collections .abc import Callable , Container , Mapping
3- from types import GeneratorType
2+ from collections .abc import Callable , Container , Generator , Mapping
43from typing import Any , Final , overload
54from typing_extensions import TypeAlias
65
@@ -59,7 +58,7 @@ class _DictSAXHandler:
5958 def push_data (self , item : _AttrDict | None , key : str , data : str ) -> _AttrDict : ...
6059
6160def parse (
62- xml_input : str | ReadableBuffer | SupportsRead [bytes ] | GeneratorType [ReadableBuffer , None , None ],
61+ xml_input : str | ReadableBuffer | SupportsRead [bytes ] | Generator [ReadableBuffer ],
6362 encoding : str | None = None ,
6463 expat : Any = ...,
6564 process_namespaces : bool = False ,
@@ -93,6 +92,8 @@ def unparse(
9392 attr_prefix : str = "@" ,
9493 cdata_key : str = "#text" ,
9594 depth : int = 0 ,
95+ # preprocessor is called like (preprocessor(key, value) for key, value in input_dict.items()).
96+ # It is expected to return its input, or a modification thereof
9697 preprocessor : Callable [[str , Any ], tuple [str , Any ]] | None = None ,
9798 pretty : bool = False ,
9899 newl : str = "\n " ,
@@ -113,6 +114,8 @@ def unparse(
113114 attr_prefix : str = "@" ,
114115 cdata_key : str = "#text" ,
115116 depth : int = 0 ,
117+ # preprocessor is called like (preprocessor(key, value) for key, value in input_dict.items()).
118+ # It is expected to return its input, or a modification thereof
116119 preprocessor : Callable [[str , Any ], tuple [str , Any ]] | None = None ,
117120 pretty : bool = False ,
118121 newl : str = "\n " ,
0 commit comments