Repository navigation
BUG: fix SpanningTreeIterator AttributeError when using next() directly - #8584
Conversation
|
Hi, I'm a first time contributor and don't have permission to add labels. Could a maintainer add the appropriate label so the checks pass? Thanks! |
|
The first order of business is to undo the changes to unrelated files. |
|
Thanks @OliCheesman! |
361be23 to
9e19db3
Compare
b5f6fd3 to
4069a13
Compare
|
Hi again. All checks have passed. Waiting for review. |
|
@rossbar please could you look through my changes. The two changes I made originally are present and I reformatted to make sure all code fits the formatting requirements |
|
Thanks @dschult! |
|
Is it possible to get this reviewed? Many thanks |
|
This approach breaks the laziness property of the iterator. That is a nice property to have so you can initialize and pay the generator cost only when needed (for example, for online systems). I'd suggest setting the value as None during init and add a check+initialization on the next call |
|
Changes made as suggested @amcandio |
|
Is it possible to get these changes checked and merged if not problems are found? Thanks |
1657683 to
d2f7118
Compare
|
Can i have some help here please? I have made the changes required but after running the pre-commit, files I do not wish to change seem to get changed. Only formatting changes like removing whitespace. This was pointed out earlier and I tried to fix it. Could anyone provide guidance on how I should proceed? Thanks |
| fill: none; | ||
| stroke: #9ecae1; | ||
| stroke-width: .5px; | ||
| } |
There was a problem hiding this comment.
Please drop deltas that are not related to the change
8153d19 to
463975c
Compare
rossbar
left a comment
There was a problem hiding this comment.
LGTM, thanks @OliCheesman and @amcandio !
…ly (networkx#8584) Enable next(spanning_tree_iterator_instance) by moving priority queue initialization from __iter__ to __next__
Fixes #8563
The
partition_queuewas only being initialised inside__iter__, which meant callingnext()directly onSpanningTreeIterator(without a for-loop, which calls__iter__implicitly) raised anAttributeError.The fix moves the queue initialisation into
__init__so the iterator is fully operational immediately after construction. A regression test has been added toTestSpanningTreeIterator.