diff options
author | biao716.wang <biao716.wang@samsung.com> | 2022-11-30 19:28:25 +0900 |
---|---|---|
committer | biao716.wang <biao716.wang@samsung.com> | 2022-11-30 19:28:25 +0900 |
commit | ee957c99c2aa8346c87392aa7547295ce1192a0d (patch) | |
tree | 124da3e58d243152fe5026fdcc8d71e1f88034bd | |
parent | 268f9f0c7823e856f7f63494a4e12dce5ec8cbbd (diff) | |
download | git-buildpackage-ee957c99c2aa8346c87392aa7547295ce1192a0d.tar.gz git-buildpackage-ee957c99c2aa8346c87392aa7547295ce1192a0d.tar.bz2 git-buildpackage-ee957c99c2aa8346c87392aa7547295ce1192a0d.zip |
fix next error in linkedlist.py
Change-Id: I76f6ad919b415e4bff845ce1fef4182ba6fa9ab5
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
-rw-r--r-- | gbp/rpm/linkedlist.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gbp/rpm/linkedlist.py b/gbp/rpm/linkedlist.py index c622f603..ac121316 100644 --- a/gbp/rpm/linkedlist.py +++ b/gbp/rpm/linkedlist.py @@ -12,8 +12,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, please see +# <http://www.gnu.org/licenses/> """Simple implementation of a doubly linked list""" import collections @@ -59,12 +59,11 @@ class LinkedListNode(object): data = "" self._data = data - def delete(self): """Delete node""" if self.prev: - self.prev.next = self.__next__ - if self.__next__: + self.prev.next = self.next + if self.next: self.next.prev = self.prev self._data = None @@ -78,11 +77,14 @@ class LinkedListIterator(collections.abc.Iterator): def __next__(self): ret = self._next if ret: - self._next = ret.__next__ + self._next = ret.next else: raise StopIteration return ret + def next(self): + return self.__next__() + class LinkedList(collections.abc.Iterable): """Doubly linked list""" @@ -171,8 +173,8 @@ class LinkedList(collections.abc.Iterable): >>> [str(data) for data in list] ['foo', 'baz', 'bar'] """ - new = LinkedListNode(data, prev_node=node, next_node=node.__next__) - if node.__next__: + new = LinkedListNode(data, prev_node=node, next_node=node.next) + if node.next: node.next.prev = new else: self._last = new @@ -205,10 +207,11 @@ class LinkedList(collections.abc.Iterable): """ ret = node.prev if node is self._first: - ret = self._first = self._first.__next__ + ret = self._first = self._first.next if node is self._last: self._last = self._last.prev node.delete() return ret # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: + |