Skip to content

Commit

Permalink
fix: type ignore compatibility with latest mypy (#2127)
Browse files Browse the repository at this point in the history
New mypy has more specific type errors so the type: ignore[misc] is no
longer effective.
  • Loading branch information
aucampia committed Oct 9, 2022
1 parent 09695f5 commit ba43dd7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rdflib/plugins/sparql/results/txtresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def c(s, w):
keys: List[Variable] = self.result.vars # type: ignore[assignment]
maxlen = [0] * len(keys)
b = [
# type error: Value of type "Union[Tuple[IdentifiedNode, IdentifiedNode, Identifier], bool, ResultRow]" is not indexable
# type error: Invalid tuple index type (actual type "Variable", expected type "Union[int, slice]")
# error: Argument 1 to "_termString" has incompatible type "Union[Any, Identifier]"; expected "Union[URIRef, Literal, BNode, None]"
# type error: Value of type "Union[Tuple[Node, Node, Node], bool, ResultRow]" is not indexable
# type error: Argument 1 to "_termString" has incompatible type "Union[Node, Any]"; expected "Union[URIRef, Literal, BNode, None]" [arg-type]
# type error: No overload variant of "__getitem__" of "tuple" matches argument type "Variable"
# NOTE on type error: The problem here is that r can be more types than _termString expects because result can be a result of multiple types.
[_termString(r[k], namespace_manager) for k in keys] # type: ignore[index,misc,arg-type]
[_termString(r[k], namespace_manager) for k in keys] # type: ignore[index, arg-type, call-overload]
for r in self.result
]
for r in b:
Expand Down

0 comments on commit ba43dd7

Please sign in to comment.