8000 remove old hacks against 2to3 by a-detiste · Pull Request #3095 · RDFLib/rdflib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

remove old hacks against 2to3 #3095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 24, 2025
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: 3 additions & 6 deletions rdflib/plugins/parsers/rdfxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions rdflib/plugins/stores/berkeleydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
Loading
0