Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dir-sdk-python/agntcy/dir_sdk/client/auth/oauth_pkce.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def run_loopback_pkce_login(
done = threading.Event()

class _Handler(BaseHTTPRequestHandler):
def do_GET(self) -> None: # noqa: N802
def do_GET(self) -> None:
try:
req = urlparse(self.path)
if req.path != path:
Expand Down
2 changes: 1 addition & 1 deletion dir-sdk-python/agntcy/dir_sdk/client/auth/token_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CachedToken:
created_at: datetime | None = None

@classmethod
def from_json(cls, payload: dict[str, Any]) -> "CachedToken":
def from_json(cls, payload: dict[str, Any]) -> CachedToken:
return cls(
access_token=str(payload.get("access_token", "")),
token_type=str(payload.get("token_type", "")),
Expand Down
5 changes: 3 additions & 2 deletions dir-sdk-python/agntcy/dir_sdk/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import os
from typing import ClassVar


def _parse_bool_env(value: str | None, default: bool) -> bool:
Expand Down Expand Up @@ -83,7 +84,7 @@ def prune_mounts(self) -> None:
mounts = []
for mount in self.mounts:
if mount.startswith("type=bind"):
type, src, dst = mount.split(",")
_type, src, _dst = mount.split(",")
_, src = src.split("=")
if os.path.isfile(src):
mounts.append(mount)
Expand All @@ -109,7 +110,7 @@ class Config:
DEFAULT_OIDC_REDIRECT_URI: str = "http://localhost:8484/callback"
DEFAULT_OIDC_CALLBACK_PORT: int = 8484
DEFAULT_OIDC_AUTH_TIMEOUT: float = 300.0
DEFAULT_OIDC_SCOPES: list[str] = ["openid", "profile", "email"]
DEFAULT_OIDC_SCOPES: ClassVar[list[str]] = ["openid", "profile", "email"]

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions dir-sdk-python/agntcy/dir_sdk/client/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def __init__(self, logger: logging.Logger) -> None:
def _invoke(self, op_name: str, error_message: str, call: Callable[[], T]) -> T:
try:
return cast(T, call())
except grpc.RpcError as e:
self._logger.exception("gRPC error during %s: %s", op_name, e)
except grpc.RpcError:
self._logger.exception("gRPC error during %s", op_name)
raise
except Exception as e:
self._logger.exception("Unexpected error during %s: %s", op_name, e)
self._logger.exception("Unexpected error during %s", op_name)
msg = f"{error_message}: {e}"
raise RuntimeError(msg) from e

Expand Down
6 changes: 3 additions & 3 deletions dir-sdk-python/agntcy/dir_sdk/client/services/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def listen(
return self._event_client.Listen(req, metadata=metadata)
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.CANCELLED:
self._logger.exception("gRPC listen stream was canceled: %s", e)
self._logger.exception("gRPC listen stream was canceled")
else:
self._logger.exception("gRPC error during listen: %s", e)
self._logger.exception("gRPC error during listen")
raise
except Exception as e:
self._logger.exception("Unexpected error during listen: %s", e)
self._logger.exception("Unexpected error during listen")
msg = f"Failed to listen: {e}"
raise RuntimeError(msg) from e
8 changes: 4 additions & 4 deletions dir-sdk-python/agntcy/dir_sdk/client/services/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def verify(
try:
return self._sign_client.Verify(req, metadata=metadata or ())
except grpc.RpcError as e:
self._logger.exception("gRPC error during verify: %s", e)
self._logger.exception("gRPC error during verify")
raise RuntimeError(f"Verify failed: {e}") from e
except Exception as e:
self._logger.exception("Verification failed: %s", e)
self._logger.exception("Verification failed")
raise RuntimeError(f"Verify failed: {e}") from e
try:
return verify_record(self._config, req)
except Exception as e:
self._logger.exception("Verification operation failed: %s", e)
self._logger.exception("Verification operation failed")
raise RuntimeError(f"Failed to verify the object: {e}") from e

def sign(self, req: sign_v1.SignRequest) -> None:
Expand All @@ -56,5 +56,5 @@ def sign(self, req: sign_v1.SignRequest) -> None:
except RuntimeError as e:
raise RuntimeError(f"Failed to sign the object: {e}") from e
except Exception as e:
self._logger.exception("Signing operation failed: %s", e)
self._logger.exception("Signing operation failed")
raise RuntimeError(f"Failed to sign the object: {e}") from e
3 changes: 1 addition & 2 deletions dir-sdk-python/agntcy/dir_sdk/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ def cancel_stream() -> None:

def read_stream() -> None:
try:
for response in listen_stream:
events.append(response)
events.extend(listen_stream)
except grpc.RpcError as e:
if e.code() != grpc.StatusCode.CANCELLED:
raise
Expand Down
2 changes: 1 addition & 1 deletion examples/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dev = [
"pytest-cov>=6.0.0",
"uuid>=1.30",
"mypy==2.3.0",
"ruff==0.15.22",
"ruff==0.16.0",
"pydantic>=2.13.4",
]

Expand Down
40 changes: 20 additions & 20 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.