Skip to content

Commit

Permalink
Fix tuple typing mistake in triples_choices (#2987)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer authored Nov 18, 2024
1 parent fa5239f commit 0680442
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,19 +966,19 @@ def triples_choices(
self,
triple: (
tuple[
list[_SubjectType] | tuple[_SubjectType],
list[_SubjectType] | tuple[_SubjectType, ...],
_PredicateType,
_ObjectType | None,
]
| tuple[
_SubjectType | None,
list[_PredicateType] | tuple[_PredicateType],
list[_PredicateType] | tuple[_PredicateType, ...],
_ObjectType | None,
]
| tuple[
_SubjectType | None,
_PredicateType,
list[_ObjectType] | tuple[_ObjectType],
list[_ObjectType] | tuple[_ObjectType, ...],
]
),
context: _ContextType | None = None,
Expand Down Expand Up @@ -2208,19 +2208,19 @@ def triples_choices(
self,
triple: (
tuple[
list[_SubjectType] | tuple[_SubjectType],
list[_SubjectType] | tuple[_SubjectType, ...],
_PredicateType,
_ObjectType | None,
]
| tuple[
_SubjectType | None,
list[_PredicateType] | tuple[_PredicateType],
list[_PredicateType] | tuple[_PredicateType, ...],
_ObjectType | None,
]
| tuple[
_SubjectType | None,
_PredicateType,
list[_ObjectType] | tuple[_ObjectType],
list[_ObjectType] | tuple[_ObjectType, ...],
]
),
context: _ContextType | None = None,
Expand Down Expand Up @@ -2962,19 +2962,19 @@ def triples_choices(
self,
triple: (
tuple[
list[_SubjectType] | tuple[_SubjectType],
list[_SubjectType] | tuple[_SubjectType, ...],
_PredicateType,
_ObjectType | None,
]
| tuple[
_SubjectType | None,
list[_PredicateType] | tuple[_PredicateType],
list[_PredicateType] | tuple[_PredicateType, ...],
_ObjectType | None,
]
| tuple[
_SubjectType | None,
_PredicateType,
list[_ObjectType] | tuple[_ObjectType],
list[_ObjectType] | tuple[_ObjectType, ...],
]
),
context: _ContextType | None = None,
Expand Down
6 changes: 3 additions & 3 deletions rdflib/plugins/stores/sparqlstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,19 +408,19 @@ def triples_choices(
self,
_: (
tuple[
list[_SubjectType] | tuple[_SubjectType],
list[_SubjectType] | tuple[_SubjectType, ...],
_PredicateType,
_ObjectType | None,
]
| tuple[
_SubjectType | None,
list[_PredicateType] | tuple[_PredicateType],
list[_PredicateType] | tuple[_PredicateType, ...],
_ObjectType | None,
]
| tuple[
_SubjectType | None,
_PredicateType,
list[_ObjectType] | tuple[_ObjectType],
list[_ObjectType] | tuple[_ObjectType, ...],
]
),
context: _ContextType | None = None,
Expand Down
12 changes: 6 additions & 6 deletions rdflib/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,19 @@ def triples_choices(
self,
triple: (
tuple[
list[_SubjectType] | tuple[_SubjectType],
list[_SubjectType] | tuple[_SubjectType, ...],
_PredicateType,
_ObjectType | None,
]
| tuple[
_SubjectType | None,
list[_PredicateType] | tuple[_PredicateType],
list[_PredicateType] | tuple[_PredicateType, ...],
_ObjectType | None,
]
| tuple[
_SubjectType | None,
_PredicateType,
list[_ObjectType] | tuple[_ObjectType],
list[_ObjectType] | tuple[_ObjectType, ...],
]
),
context: _ContextType | None = None,
Expand All @@ -301,9 +301,9 @@ def triples_choices(
time from the default 'fallback' implementation, which will iterate
over each term in the list and dispatch to triples
"""
subject: _SubjectType | list[_SubjectType] | tuple[_SubjectType] | None
predicate: _PredicateType | list[_PredicateType] | tuple[_PredicateType]
object_: _ObjectType | list[_ObjectType] | tuple[_ObjectType] | None
subject: _SubjectType | list[_SubjectType] | tuple[_SubjectType, ...] | None
predicate: _PredicateType | list[_PredicateType] | tuple[_PredicateType, ...]
object_: _ObjectType | list[_ObjectType] | tuple[_ObjectType, ...] | None
subject, predicate, object_ = triple
if isinstance(object_, (list, tuple)):
# MyPy thinks these are unreachable due to the triple pattern signature.
Expand Down

0 comments on commit 0680442

Please sign in to comment.