|
def walk(self, action: Callable[[Element, Element], Any], doc: Element | None=None, stop_if=None) -> Element | None: |
The action function:
- parameter takes
[Element, Doc] as arguments not [Element, Element]
- returns an
Element, typing Any isn't very useful
The doc parameter take a Doc not an Element.
The documentation/helpstring for this function says an empty list can be returned. This type hint says it can not. What is correct. Can an empty list be returned or not?
Also the Element.doc method type hint returns Any | Element. But it should be Doc shouldn't it?
panflute/panflute/base.py
Line 225 in f99f82d
The action function:
[Element, Doc]as arguments not[Element, Element]Element, typingAnyisn't very usefulThe doc parameter take a
Docnot anElement.The documentation/helpstring for this function says an empty list can be returned. This type hint says it can not. What is correct. Can an empty list be returned or not?
Also the
Element.docmethod type hint returnsAny | Element. But it should beDocshouldn't it?