diff --git a/poetry.lock b/poetry.lock index dd7ec97..f94814b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1010,17 +1010,6 @@ anyio = ">=3.4.0,<5" [package.extras] full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.7)", "pyyaml"] -[[package]] -name = "toolz" -version = "0.12.1" -description = "List processing tools and functional utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "toolz-0.12.1-py3-none-any.whl", hash = "sha256:d22731364c07d72eea0a0ad45bafb2c2937ab6fd38a3507bf55eae8744aa7d85"}, - {file = "toolz-0.12.1.tar.gz", hash = "sha256:ecca342664893f177a13dac0e6b41cbd8ac25a358e5f215316d43e2100224f4d"}, -] - [[package]] name = "typeguard" version = "4.3.0" @@ -1307,4 +1296,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "5ee63e971854c89787661ffa1d36a0c67d9c3daef9b589dbf330692a508bdb22" +content-hash = "a21db5cb445b77241f5471af79bd97a9c67425974b3fcc2ba6f6213f5ce6ee4f" diff --git a/pyproject.toml b/pyproject.toml index b4c33d6..a472b76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" sparqlwrapper = "^2.0.0" -toolz = "^0.12.1" pydantic = "^2.8.2" fastapi = {extras = ["standard"], version = "^0.112.0"} typeguard = "^4.3.0" diff --git a/rdfproxy/utils/utils.py b/rdfproxy/utils/utils.py index 9c8554a..979efaa 100644 --- a/rdfproxy/utils/utils.py +++ b/rdfproxy/utils/utils.py @@ -1,13 +1,12 @@ """SPARQL/FastAPI utils.""" -from collections.abc import Iterator, Mapping -from typing import Any, cast +from collections.abc import Iterator +from typing import Any from SPARQLWrapper import QueryResult from pydantic import BaseModel from pydantic.fields import FieldInfo from rdfproxy.utils._types import SPARQLBinding, _TModelInstance -from toolz import valmap def get_bindings_from_query_result(query_result: QueryResult) -> Iterator[dict]: @@ -18,9 +17,9 @@ def get_bindings_from_query_result(query_result: QueryResult) -> Iterator[dict]: f"Received object with requestedFormat '{result_format}'." ) - query_json = cast(Mapping, query_result.convert()) + query_json: dict = query_result.convert() bindings = map( - lambda binding: valmap(lambda v: v["value"], binding), + lambda binding: {k: v["value"] for k, v in binding.items()}, query_json["results"]["bindings"], )