Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rdflib/plugins/parsers/rdfxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions rdflib/plugins/stores/berkeleydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/test_graph/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def test_guess_format_for_parse_http_text_plain():
assert len(graph) > 0

# A url that returns content-type text/html.
url = "https://github.com/RDFLib/rdflib/issues/2734"
url = "https://www.w3.org/TR/REC-rdf-syntax/"
with pytest.raises(PluginException):
graph = Graph().parse(url)

Expand Down
Loading