Skip to content

Commit 339ea08

Browse files
committed
fix: correct custom target parser support in ElementTree again
1 parent 24945ce commit 339ea08

1 file changed

Lines changed: 5 additions & 54 deletions

File tree

src/lxml-stubs/etree/_element.pyi

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -693,80 +693,31 @@ class _ElementTree(Generic[_t._ET_co]):
693693
element: _t._ET_co,
694694
*,
695695
file: None = None,
696-
) -> _ElementTree[_t._ET_co]:
697-
"""ElementTree wrapper class for Element objects.
698-
699-
Annotation
700-
----------
701-
This overload is used when creating an ElementTree directly from a root
702-
Element object. Other arguments are ignored in this case.
703-
704-
See Also
705-
--------
706-
- [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.ElementTree)
707-
"""
708-
696+
) -> _ElementTree[_t._ET_co]: ...
709697
@overload # from file source, standard parser
710698
def __new__(
711699
cls,
712700
element: None = None,
713701
*,
714702
file: _t._FileReadSource,
715703
parser: _t._DefEtreeParsers[_t._ET_co],
716-
) -> _ElementTree[_t._ET_co]:
717-
"""ElementTree wrapper class for Element objects.
718-
719-
Annotation
720-
----------
721-
This overload is used when creating an ElementTree from a file source with
722-
user-supplied standard parser.
723-
724-
See Also
725-
--------
726-
- [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.ElementTree)
727-
"""
728-
704+
) -> _ElementTree[_t._ET_co]: ...
729705
@overload # from file source, custom target parser
730706
def __new__(
731707
cls,
732708
element: None = None,
733709
*,
734710
file: _t._FileReadSource,
735-
parser: CustomTargetParser[_t._ET_co],
736-
) -> _ElementTree[_t._ET_co]:
737-
"""ElementTree wrapper class for Element objects.
738-
739-
Annotation
740-
----------
741-
This overload is used when creating an ElementTree from a file source with
742-
custom target parser. Returns the result dictated by parser target object
743-
instead of ElementTree.
744-
745-
See Also
746-
--------
747-
- [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.ElementTree)
748-
"""
749-
711+
parser: CustomTargetParser[_T],
712+
) -> _T: ...
750713
@overload # from file source, no parser supplied
751714
def __new__(
752715
cls,
753716
element: None = None,
754717
*,
755718
file: _t._FileReadSource,
756719
parser: None = None,
757-
) -> _ElementTree[_t._ET_co]:
758-
"""ElementTree wrapper class for Element objects.
759-
760-
Annotation
761-
----------
762-
This overload is used when creating an ElementTree from a file source
763-
without a parser supplied. The default parser is used in this case.
764-
765-
See Also
766-
--------
767-
- [API Documentation](https://lxml.de/apidoc/lxml.etree.html#lxml.etree.ElementTree)
768-
"""
769-
720+
) -> _ElementTree[_t._ET_co]: ...
770721
@property
771722
def parser(self) -> _t._DefEtreeParsers[_t._ET_co] | None: ...
772723
@property

0 commit comments

Comments
 (0)