@@ -427,7 +427,8 @@ def remove( # type: ignore[override]
427427 cursor = index .cursor (txn = txn )
428428 try :
429429 cursor .set_range (key )
430- current = cursor .next
430+ # Hack to stop 2to3 converting this to next(cursor)
431+ current = getattr (cursor , "next" )()
431432 except db .DBNotFoundError :
432433 current = None
433434 cursor .close ()
@@ -504,7 +505,8 @@ def triples(
504505 cursor = index .cursor (txn = txn )
505506 try :
506507 cursor .set_range (key )
507- current = cursor .next
508+ # Cheap hack so 2to3 doesn't convert to next(cursor)
509+ current = getattr (cursor , "next" )()
508510 except db .DBNotFoundError :
509511 current = None
510512 cursor .close ()
@@ -536,7 +538,8 @@ def __len__(self, context: _ContextType | None = None) -> int:
536538 key , value = current
537539 if key .startswith (prefix ):
538540 count += 1
539- current = cursor .next
541+ # Hack to stop 2to3 converting this to next(cursor)
542+ current = getattr (cursor , "next" )()
540543 else :
541544 break
542545 cursor .close ()
@@ -589,7 +592,8 @@ def namespaces(self) -> Generator[tuple[str, URIRef], None, None]:
589592 while current :
590593 prefix , namespace = current
591594 results .append ((prefix .decode ("utf-8" ), namespace .decode ("utf-8" )))
592- current = cursor .next
595+ # Hack to stop 2to3 converting this to next(cursor)
596+ current = getattr (cursor , "next" )()
593597 cursor .close ()
594598 for prefix , namespace in results :
595599 yield prefix , URIRef (namespace )
@@ -628,7 +632,8 @@ def contexts(
628632 cursor = index .cursor ()
629633 try :
630634 cursor .set_range (key )
631- current = cursor .next
635+ # Hack to stop 2to3 converting this to next(cursor)
636+ current = getattr (cursor , "next" )()
632637 except db .DBNotFoundError :
633638 current = None
634639 cursor .close ()
0 commit comments