diff --git a/rdflib/plugins/parsers/rdfxml.py b/rdflib/plugins/parsers/rdfxml.py index e0f6e05fa..54fc69567 100644 --- a/rdflib/plugins/parsers/rdfxml.py +++ b/rdflib/plugins/parsers/rdfxml.py @@ -298,7 +298,8 @@ def document_element_start( self, name: Tuple[str, str], qname, attrs: AttributesImpl ) -> None: if name[0] and URIRef("".join(name)) == RDFVOC.RDF: - next = self.next + # Cheap hack so 2to3 doesn't turn it into __next__ + next = getattr(self, "next") next.start = self.node_element_start next.end = self.node_element_end else: @@ -315,7 +316,8 @@ def node_element_start( current = self.current absolutize = self.absolutize - next = self.next + # Cheap hack so 2to3 doesn't turn it into __next__ + next = getattr(self, "next") next.start = self.property_element_start next.end = self.property_element_end @@ -408,7 +410,8 @@ def property_element_start( current = self.current absolutize = self.absolutize - next = self.next + # Cheap hack so 2to3 doesn't turn it into __next__ + next = getattr(self, "next") object: Optional[_ObjectType] = None current.data = None current.list = None diff --git a/rdflib/plugins/stores/berkeleydb.py b/rdflib/plugins/stores/berkeleydb.py index 872dc368e..12009787c 100644 --- a/rdflib/plugins/stores/berkeleydb.py +++ b/rdflib/plugins/stores/berkeleydb.py @@ -428,7 +428,8 @@ def remove( # type: ignore[override] cursor = index.cursor(txn=txn) try: cursor.set_range(key) - current = cursor.next + # Hack to stop 2to3 converting this to next(cursor) + current = getattr(cursor, "next")() except db.DBNotFoundError: current = None cursor.close() @@ -505,7 +506,8 @@ def triples( cursor = index.cursor(txn=txn) try: cursor.set_range(key) - current = cursor.next + # Cheap hack so 2to3 doesn't convert to next(cursor) + current = getattr(cursor, "next")() except db.DBNotFoundError: current = None cursor.close() @@ -537,7 +539,8 @@ def __len__(self, context: Optional[_ContextType] = None) -> int: key, value = current if key.startswith(prefix): count += 1 - current = cursor.next + # Hack to stop 2to3 converting this to next(cursor) + current = getattr(cursor, "next")() else: break cursor.close() @@ -590,7 +593,8 @@ def namespaces(self) -> Generator[Tuple[str, URIRef], None, None]: while current: prefix, namespace = current results.append((prefix.decode("utf-8"), namespace.decode("utf-8"))) - current = cursor.next + # Hack to stop 2to3 converting this to next(cursor) + current = getattr(cursor, "next")() cursor.close() for prefix, namespace in results: yield prefix, URIRef(namespace) @@ -633,7 +637,8 @@ def contexts( cursor = index.cursor() try: cursor.set_range(key) - current = cursor.next + # Hack to stop 2to3 converting this to next(cursor) + current = getattr(cursor, "next")() except db.DBNotFoundError: current = None cursor.close()