Skip to content

Commit

Permalink
chore(deps): Update pandera
Browse files Browse the repository at this point in the history
  • Loading branch information
leifwar committed Jul 17, 2024
1 parent 2220e4e commit 6993b24
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.10
rev: v0.5.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 2 additions & 4 deletions cimsparql/data_models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import datetime as dt
from typing import ClassVar, Self
from typing import Self

import pandas as pd
import pandera as pa
from pandera.typing import DataFrame, Index, Series


class JsonSchemaOut(pa.SchemaModel):
class JsonSchemaOut(pa.DataFrameModel):
class Config:

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)

Check failure on line 10 in cimsparql/data_models.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

"Config" overrides symbol of same name in class "DataFrameModel"   "type[Config]" is incompatible with "type[BaseConfig]"   Type "type[Config]" is incompatible with type "type[BaseConfig]" (reportIncompatibleVariableOverride)
to_format = "json"
to_format_kwargs: ClassVar[dict[str, str]] = {"orient": "table"}
coerce = True


Expand Down
19 changes: 13 additions & 6 deletions cimsparql/graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def get_prefixes(self, http_transport: httpx.BaseTransport | None = None) -> dic
# via `update_prefixes`. By default we load a pre-defined set of prefixes
return prefixes

with httpx.Client(transport=http_transport) as client:
with httpx.Client(transport=http_transport, timeout=5.0) as client:
response = client.get(
self.service_cfg.url + "/namespaces",
auth=self.service_cfg.auth or httpx.USE_CLIENT_DEFAULT,
Expand All @@ -306,7 +306,7 @@ def get_prefixes(self, http_transport: httpx.BaseTransport | None = None) -> dic

def delete_repo(self) -> None:
endpoint = delete_repo_endpoint(self.service_cfg)
response = httpx.delete(endpoint)
response = httpx.delete(endpoint, timeout=5.0)
response.raise_for_status()

def upload_rdf(
Expand All @@ -333,6 +333,7 @@ def read_xml_content(file: Path) -> bytes:
content=xml_content,
params=params,
headers={"Content-Type": MIME_TYPE_RDF_FORMATS[rdf_format]},
timeout=5.0,
)
response.raise_for_status()

Expand All @@ -346,6 +347,7 @@ def update_query(self, query: str) -> None:
headers=self.sparql.customHttpHeaders
| {"Content-Type": "application/x-www-form-urlencoded"},
auth=self.service_cfg.auth,
timeout=5.0,
)
response.raise_for_status()

Expand All @@ -356,14 +358,16 @@ def set_namespace(self, prefix: str, value: str) -> None:
content=value,
headers={"Content-Type": "text/plain"},
auth=self.service_cfg.auth,
timeout=5.0,
)
response.raise_for_status()

@require_rdf4j

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.11

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)

Check failure on line 365 in cimsparql/graphdb.py

View workflow job for this annotation

GitHub Actions / ubuntu-latest / 3.12

Argument of type "(self: Self@GraphDBClient, prefix: str) -> str" cannot be assigned to parameter "f" of type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j" in function "require_rdf4j"   Type "(self: Self@GraphDBClient, prefix: str) -> str" is incompatible with type "(GraphDBClient, **P@require_rdf4j) -> T@require_rdf4j"     Parameter 1: type "GraphDBClient" is incompatible with type "Self@GraphDBClient"       Type "GraphDBClient" is incompatible with type "Self@GraphDBClient" (reportArgumentType)
def get_namespace(self, prefix: str) -> str:
response = httpx.get(
self.service_cfg.url + f"/namespaces/{prefix}", auth=self.service_cfg.auth
self.service_cfg.url + f"/namespaces/{prefix}", auth=self.service_cfg.auth, timeout=5.0
)

response.raise_for_status()
return response.text

Expand All @@ -390,7 +394,7 @@ def repos(service_cfg: ServiceConfig | None = None) -> list[RepoInfo]:

url = f"{service_cfg.protocol}://{service_cfg.server}/repositories"

with httpx.Client() as client:
with httpx.Client(timeout=5.0) as client:
response = client.get(url, auth=auth, headers={"Accept": "application/json"})
response.raise_for_status()

Expand Down Expand Up @@ -424,7 +428,7 @@ def new_repo(
"""
ignored_errors = {HTTPStatus.CONFLICT} if allow_exist else set[HTTPStatus]()
url = service(repo, server, protocol)
response = httpx.put(url, content=config, headers={"Content-Type": "text/turtle"})
response = httpx.put(url, content=config, headers={"Content-Type": "text/turtle"}, timeout=5.0)
if response.status_code not in ignored_errors:
response.raise_for_status()

Expand All @@ -438,7 +442,10 @@ def new_repo_blazegraph(
config = config_bytes_from_template(template, {"repo": repo})

response = httpx.post(
f"{protocol}://{url}", content=config, headers={"Content-type": "application/xml"}
f"{protocol}://{url}",
content=config,
headers={"Content-type": "application/xml"},
timeout=5.0,
)
response.raise_for_status()
client = GraphDBClient(
Expand Down
Loading

0 comments on commit 6993b24

Please sign in to comment.