Skip to content

add iterator methods to lxml #1647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

add iterator methods to lxml #1647

wants to merge 3 commits into from

Conversation

redmer
Copy link

@redmer redmer commented Oct 4, 2017

I've added a couple of iterators and iterator methods to lxml. Nevertheless, many methods from lxml are still missing, cf. #525.

Both python 3 test suits pass.

@@ -17,23 +17,67 @@ _DictAnyStr = Union[Dict[str, str], Dict[bytes, bytes]]
_Dict_Tuple2AnyStr_Any = Union[Dict[Tuple[str, str], Any], Tuple[bytes, bytes], Any]


class ElementChildIterator(Iterator['_Element']):
class _ElementMatchIterator(Iterator['_Element']):
def __iter__(self) -> '_ElementMatchIterator': ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these overridden __iter__/__next__ methods seem to be redundant. I think you can just write most of these classes like class _ElementMatchIterator(Iterator[_Element]): .... __iter__ and __next__ will be inherited correctly. In that case, leave no blank space between the classes.

@funkyfuture
Copy link

with #1664 the lxml stubs will be removed.

@JelleZijlstra
Copy link
Member

The lxml stubs are now gone. Feel free to submit this change to https://github.com/JelleZijlstra/lxml-stubs instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants