build(deps-dev): bump mypy from 0.991 to 1.0.1 (#2247) · RDFLib/rdflib@a146e0a (original) (raw)

8 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ lxml = {version = "^4.3.0", optional = true}
43 43 [tool.poetry.group.dev.dependencies]
44 44 black = "22.12.0"
45 45 isort = "^5.10.0"
46 -mypy = "0.991"
46 +mypy = "1.0.1"
47 47 lxml-stubs = "^0.4.0"
48 48
49 49 [tool.poetry.group.tests.dependencies]
Original file line number Diff line number Diff line change
@@ -1536,8 +1536,7 @@ def query(
1536 1536 except NotImplementedError:
1537 1537 pass # store has no own implementation
1538 1538
1539 -# type error: Subclass of "str" and "Result" cannot exist: would have incompatible method signatures
1540 -if not isinstance(result, query.Result): # type: ignore[unreachable]
1539 +if not isinstance(result, query.Result):
1541 1540 result = plugin.get(cast(str, result), query.Result)
1542 1541 if not isinstance(processor, query.Processor):
1543 1542 processor = plugin.get(processor, query.Processor)(self)
Original file line number Diff line number Diff line change
@@ -372,7 +372,7 @@ def create_input_source(
372 372 location = str(source)
373 373 elif isinstance(source, bytes):
374 374 data = source
375 -elif hasattr(source, "read") and not isinstance(source, Namespace): # type: ignore[unreachable]
375 +elif hasattr(source, "read") and not isinstance(source, Namespace):
376 376 f = source
377 377 input_source = InputSource()
378 378 if hasattr(source, "encoding"):
Original file line number Diff line number Diff line change
@@ -108,6 +108,8 @@ def test_content_negotiation(self) -> None:
108 108
109 109 with ctx_http_server(ContentNegotiationHandler) as server:
110 110 (host, port) = server.server_address
111 +if isinstance(host, (bytes, bytearray)):
112 +host = host.decode("utf-8")
111 113 url = f"http://{host}:{port}/foo"
112 114 for format in ("xml", "n3", "nt"):
113 115 graph = Graph()
@@ -121,6 +123,8 @@ def test_content_negotiation_no_format(self) -> None:
121 123
122 124 with ctx_http_server(ContentNegotiationHandler) as server:
123 125 (host, port) = server.server_address
126 +if isinstance(host, (bytes, bytearray)):
127 +host = host.decode("utf-8")
124 128 url = f"http://{host}:{port}/foo"
125 129 graph = Graph()
126 130 graph.parse(url)
Original file line number Diff line number Diff line change
@@ -208,8 +208,7 @@ def test_serialize_badformat(simple_graph: Graph) -> None:
208 208
209 209 def narrow_dest_param(param: DestParmType) -> GraphDestParamType:
210 210 assert not (hasattr(param, "write") and hasattr(param, "encoding"))
211 -# type error: Subclass of "IO[bytes]" and "TextIO" cannot exist: would have inconsistent method resolution order
212 -assert not isinstance(param, TextIO) # type: ignore[unreachable]
211 +assert not isinstance(param, TextIO)
213 212 return param
214 213
215 214
Original file line number Diff line number Diff line change
@@ -218,8 +218,7 @@ def quad_set(
218 218 for sn, pn, on, gn in graph.quads((None, None, None, None)):
219 219 gn_id: Identifier
220 220 if isinstance(graph, Dataset):
221 -# type error: Subclass of "Graph" and "Identifier" cannot exist: would have incompatible method signatures
222 -assert isinstance(gn, Identifier) # type: ignore[unreachable]
221 +assert isinstance(gn, Identifier)
223 222 gn_id = gn # type: ignore[unreachable]
224 223 elif isinstance(graph, ConjunctiveGraph):
225 224 assert isinstance(gn, Graph)
Original file line number Diff line number Diff line change
@@ -191,6 +191,8 @@ def stop(self) -> None:
191 191 @property
192 192 def address_string(self) -> str:
193 193 (host, port) = self.server.server_address
194 +if isinstance(host, (bytes, bytearray)):
195 +host = host.decode("utf-8")
194 196 return f"{host}:{port}"
195 197
196 198 @property