diff --git a/rdflib/plugins/parsers/rdfxml.py b/rdflib/plugins/parsers/rdfxml.py index 6ce4dd3cb..456d9db70 100644 --- a/rdflib/plugins/parsers/rdfxml.py +++ b/rdflib/plugins/parsers/rdfxml.py @@ -298,8 +298,7 @@ def document_element_start( self, name: tuple[str, str], qname, attrs: AttributesImpl ) -> None: if name[0] and URIRef("".join(name)) == RDFVOC.RDF: - # Cheap hack so 2to3 doesn't turn it into __next__ - next = getattr(self, "next") + next = self.next next.start = self.node_element_start next.end = self.node_element_end else: @@ -316,8 +315,7 @@ def node_element_start( current = self.current absolutize = self.absolutize - # Cheap hack so 2to3 doesn't turn it into __next__ - next = getattr(self, "next") + next = self.next next.start = self.property_element_start next.end = self.property_element_end @@ -410,8 +408,7 @@ def property_element_start( current = self.current absolutize = self.absolutize - # Cheap hack so 2to3 doesn't turn it into __next__ - next = getattr(self, "next") + next = self.next object: _ObjectType | None = None current.data = None current.list = None diff --git a/rdflib/plugins/stores/berkeleydb.py b/rdflib/plugins/stores/berkeleydb.py index c3ad61d90..9bf511275 100644 --- a/rdflib/plugins/stores/berkeleydb.py +++ b/rdflib/plugins/stores/berkeleydb.py @@ -429,8 +429,7 @@ def remove( # type: ignore[override] cursor = index.cursor(txn=txn) try: cursor.set_range(key) - # Hack to stop 2to3 converting this to next(cursor) - current = getattr(cursor, "next")() + current = cursor.next except db.DBNotFoundError: current = None cursor.close() @@ -507,8 +506,7 @@ def triples( cursor = index.cursor(txn=txn) try: cursor.set_range(key) - # Cheap hack so 2to3 doesn't convert to next(cursor) - current = getattr(cursor, "next")() + current = cursor.next except db.DBNotFoundError: current = None cursor.close() @@ -540,8 +538,7 @@ def __len__(self, context: _ContextType | None = None) -> int: key, value = current if key.startswith(prefix): count += 1 - # Hack to stop 2to3 converting this to next(cursor) - current = getattr(cursor, "next")() + current = cursor.next else: break cursor.close() @@ -594,8 +591,7 @@ def namespaces(self) -> Generator[tuple[str, URIRef], None, None]: while current: prefix, namespace = current results.append((prefix.decode("utf-8"), namespace.decode("utf-8"))) - # Hack to stop 2to3 converting this to next(cursor) - current = getattr(cursor, "next")() + current = cursor.next cursor.close() for prefix, namespace in results: yield prefix, URIRef(namespace) @@ -634,8 +630,7 @@ def contexts( cursor = index.cursor() try: cursor.set_range(key) - # Hack to stop 2to3 converting this to next(cursor) - current = getattr(cursor, "next")() + current = cursor.next except db.DBNotFoundError: current = None cursor.close()