fix next error in linkedlist.py
authorbiao716.wang <biao716.wang@samsung.com>
Wed, 30 Nov 2022 10:28:25 +0000 (19:28 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Wed, 30 Nov 2022 10:28:25 +0000 (19:28 +0900)
Change-Id: I76f6ad919b415e4bff845ce1fef4182ba6fa9ab5
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
gbp/rpm/linkedlist.py

index c622f60..ac12131 100644 (file)
@@ -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\:·:
+