@@ -14,19 +14,62 @@ from .._types import (
1414 _TextArg ,
1515)
1616
17+ @overload
18+ @deprecated ("Supply an iterable of namespace prefixes, instead of a vanilla prefix." )
19+ def cleanup_namespaces (
20+ tree_or_element : _ElementOrTree ,
21+ top_nsmap : _NSMapArg | None ,
22+ keep_ns_prefixes : _TextArg ,
23+ ) -> None :
24+ """Remove all namespace declarations from a subtree that are not used by any
25+ of the elements or attributes in that tree.
26+
27+ Annotation
28+ ----------
29+ This overload guards against using a single namespace prefix string in
30+ `keep_ns_prefixes` argument. Otherwise, the string is split into
31+ individual characters and each of them is treated as a namespace prefix.
32+
33+ See Also
34+ --------
35+ - [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.cleanup_namespaces)
36+ """
37+
1738@overload
1839@deprecated ("Supply an iterable of namespace prefixes, instead of a vanilla prefix." )
1940def cleanup_namespaces (
2041 tree_or_element : _ElementOrTree ,
2142 top_nsmap : _NSMapArg | None = None ,
22- keep_ns_prefixes : _TextArg | None = None ,
23- ) -> None : ...
43+ * ,
44+ keep_ns_prefixes : _TextArg ,
45+ ) -> None :
46+ """Remove all namespace declarations from a subtree that are not used by any
47+ of the elements or attributes in that tree.
48+
49+ Annotation
50+ ----------
51+ This overload guards against using a single namespace prefix string in
52+ `keep_ns_prefixes` argument. Otherwise, the string is split into
53+ individual characters and each of them is treated as a namespace prefix.
54+
55+ See Also
56+ --------
57+ - [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.cleanup_namespaces)
58+ """
59+
2460@overload
2561def cleanup_namespaces (
2662 tree_or_element : _ElementOrTree ,
2763 top_nsmap : _NSMapArg | None = None ,
2864 keep_ns_prefixes : Iterable [_TextArg ] | None = None ,
29- ) -> None : ...
65+ ) -> None :
66+ """Remove all namespace declarations from a subtree that are not used by any
67+ of the elements or attributes in that tree.
68+
69+ See Also
70+ --------
71+ - [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.cleanup_namespaces)
72+ """
3073
3174# For functions below, the first `tree_or_element` argument
3275# can never be keyword argument, since tag/attribute names
0 commit comments