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
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Ruff Format Check
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1.0.0
with:
version: 0.12.10
version: 0.13.3
args: "format --check"
- name: Ruff Lint Check
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1.0.0
with:
version: 0.12.10
version: 0.13.3
args: "check"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ensure this is synced with pyproject.toml
rev: v0.12.10
rev: v0.13.3
hooks:
# Run the linter
- id: ruff
Expand Down
1 change: 0 additions & 1 deletion acapy_agent/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

def init_debug(args):
"""Initialize debugging environment."""

ENABLE_PTVSD = os.getenv("ENABLE_PTVSD", "").lower()
ENABLE_PTVSD = ENABLE_PTVSD and ENABLE_PTVSD not in ("false", "0")

Expand Down
7 changes: 3 additions & 4 deletions acapy_agent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ async def send_outbound(
Args:
message: The `OutboundMessage` to be sent
**kwargs: Additional keyword arguments

"""
profile = self._profile()
if not profile:
Expand All @@ -117,6 +118,7 @@ async def send_webhook(self, topic: str, payload: dict):
Args:
topic: the webhook topic identifier
payload: the webhook payload value

"""
warnings.warn(
"responder.send_webhook is deprecated; please use the event bus instead.",
Expand All @@ -136,7 +138,6 @@ def send_fn(self) -> Coroutine:
@web.middleware
async def ready_middleware(request: web.BaseRequest, handler: Coroutine):
"""Only continue if application is ready to take work."""

is_status_check = str(request.rel_url).rstrip("/") in status_paths
is_app_ready = request.app._state.get("ready")

Expand Down Expand Up @@ -241,7 +242,6 @@ async def upgrade_middleware(request: web.BaseRequest, handler: Coroutine):
@web.middleware
async def debug_middleware(request: web.BaseRequest, handler: Coroutine):
"""Show request detail in debug log."""

if LOGGER.isEnabledFor(logging.DEBUG): # Skipped if DEBUG is not enabled
LOGGER.debug("Incoming request: %s %s", request.method, request.path_qs)
is_status_check = str(request.rel_url).startswith("/status/")
Expand Down Expand Up @@ -282,6 +282,7 @@ def __init__(
conductor_stop (Coroutine): Conductor (graceful) stop for shutdown API call.
task_queue (TaskQueue, optional): An optional task queue for handlers.
conductor_stats (Coroutine, optional): Conductor statistics API call.

"""
self.app = None
self.admin_api_key = context.settings.get("admin.admin_api_key")
Expand All @@ -302,7 +303,6 @@ def __init__(

async def make_application(self) -> web.Application:
"""Get the aiohttp application instance."""

middlewares = [ready_middleware, debug_middleware]

# admin-token and admin-token are mutually exclusive and required.
Expand Down Expand Up @@ -566,7 +566,6 @@ def notify_fatal_error(self):

async def websocket_handler(self, request):
"""Send notifications to admin client over websocket."""

ws = web.WebSocketResponse()
await ws.prepare(request)
socket_id = str(uuid4())
Expand Down
1 change: 1 addition & 0 deletions acapy_agent/anoncreds/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(
obj (T, optional): The generic object associated with the instance.
*args: Variable length argument list.
**kwargs: Arbitrary keyword arguments.

"""
super().__init__(message, obj_id, obj, *args, **kwargs)
self._message = message
Expand Down
2 changes: 0 additions & 2 deletions acapy_agent/anoncreds/default/legacy_indy/recover.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async def fetch_txns(
set[int],
]:
"""Fetch tails file and revocation registry information."""

LOGGER.debug(f"Fetch revocation registry def {registry_id} from ledger")
revoc_reg_delta_request = indy_vdr.ledger.build_get_revoc_reg_def_request(
None, registry_id
Expand Down Expand Up @@ -92,7 +91,6 @@ async def fetch_txns(

async def generate_ledger_rrrecovery_txn(genesis_txns: str, rev_list: RevList) -> dict:
"""Generate a new ledger accum entry, using the wallet value if revocations ahead of ledger.""" # noqa: E501

registry_from_ledger, prev_revoked = await fetch_txns(
genesis_txns, rev_list.rev_reg_def_id, rev_list.issuer_id
)
Expand Down
3 changes: 0 additions & 3 deletions acapy_agent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def make_rev_reg_def_id(rev_reg_def: RevRegDef) -> str:

async def get_schema(self, profile: Profile, schema_id: str) -> GetSchemaResult:
"""Get a schema from the registry."""

multitenant_mgr = profile.inject_or(BaseMultitenantManager)
if multitenant_mgr:
ledger_exec_inst = IndyLedgerRequestsExecutor(profile)
Expand Down Expand Up @@ -333,7 +332,6 @@ async def get_credential_definition(
self, profile: Profile, cred_def_id: str
) -> GetCredDefResult:
"""Get a credential definition from the registry."""

async with profile.session() as session:
multitenant_mgr = session.inject_or(BaseMultitenantManager)
if multitenant_mgr:
Expand Down Expand Up @@ -1211,7 +1209,6 @@ async def txn_submit(
write_ledger: bool = True,
) -> str:
"""Submit a transaction to the ledger."""

try:
async with ledger:
return await shield(
Expand Down
3 changes: 3 additions & 0 deletions acapy_agent/anoncreds/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(

Args:
payload: CredDefFinishedPayload

"""
self._topic = CRED_DEF_FINISHED_EVENT
self._payload = payload
Expand Down Expand Up @@ -84,6 +85,7 @@ def __init__(self, payload: RevRegDefFinishedPayload):

Args:
payload: RevRegDefFinishedPayload

"""
self._topic = REV_REG_DEF_FINISHED_EVENT
self._payload = payload
Expand Down Expand Up @@ -121,6 +123,7 @@ def __init__(self, payload: RevListFinishedPayload):

Args:
payload: RevListFinishedPayload

"""
self._topic = REV_LIST_FINISHED_EVENT
self._payload = payload
Expand Down
5 changes: 1 addition & 4 deletions acapy_agent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def profile(self) -> AskarAnonCredsProfile:

async def get_master_secret(self) -> str:
"""Get or create the default master secret."""

while True:
async with self.profile.session() as session:
try:
Expand Down Expand Up @@ -381,7 +380,6 @@ async def get_credentials(self, *, offset: int, limit: int, wql: dict) -> list[d
wql: wql query dict

"""

result = []

try:
Expand Down Expand Up @@ -526,6 +524,7 @@ async def credential_revoked(

Returns:
bool: True if the credential is revoked, False otherwise.

"""
cred = await self._get_credential(credential_id)
rev_reg_id = cred.rev_reg_id
Expand Down Expand Up @@ -604,7 +603,6 @@ async def create_presentation(
rev_states: AnonCreds format revocation states JSON

"""

creds: Dict[str, Credential] = {}

def get_rev_state(cred_id: str, detail: dict):
Expand Down Expand Up @@ -750,7 +748,6 @@ async def create_revocation_state(
the revocation state

"""

try:
rev_state = await asyncio.get_event_loop().run_in_executor(
None,
Expand Down
1 change: 1 addition & 0 deletions acapy_agent/anoncreds/issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ async def credential_definition_in_wallet(

Args:
credential_definition_id: The credential definition ID to check

"""
try:
async with self.profile.session() as session:
Expand Down
7 changes: 7 additions & 0 deletions acapy_agent/anoncreds/models/credential_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, n: str, s: str, r: dict, rctxt: str, z: str, **kwargs):
and p'q'-1. This makes up part of the CL-RSA public key, independent of
the message blocks being signed.
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.n = n
Expand Down Expand Up @@ -108,6 +109,7 @@ def __init__(
r_key above.
y: is the an elliptic curve point in G2. computed as h_cap^x
(in multiplicative notation), where x is from r_key above

"""
self.g = g
self.g_dash = g_dash
Expand Down Expand Up @@ -174,6 +176,7 @@ def __init__(
primary: Cred Def value primary
revocation: Cred Def value revocation
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.primary = primary
Expand Down Expand Up @@ -226,6 +229,7 @@ def __init__(
tag: Tag
value: Cred Def value
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.issuer_id = issuer_id
Expand Down Expand Up @@ -305,6 +309,7 @@ def __init__(
state: State
credential_definition_id: Cred Def ID
credential_definition: Cred Def

"""
self.state = state
self.credential_definition_id = credential_definition_id
Expand Down Expand Up @@ -366,6 +371,7 @@ def __init__(
registration_metadata: Registration metadata
credential_definition_metadata: Cred Def metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.job_id = job_id
Expand Down Expand Up @@ -414,6 +420,7 @@ def __init__(
resolution_metadata: Resolution metadata
credential_definition_metadata: Cred Def metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.credential_definition_id = credential_definition_id
Expand Down
1 change: 1 addition & 0 deletions acapy_agent/anoncreds/models/issuer_cred_rev_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async def query_by_ids(
cred_def_id: the cred def id by which to filter
rev_reg_id: the rev reg id by which to filter
state: a state value by which to filter

"""
# Call parent method but cast return type
return await super().query_by_ids(
Expand Down
3 changes: 1 addition & 2 deletions acapy_agent/anoncreds/models/predicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def math(self) -> str:
@staticmethod
def get(relation: str) -> Union["Predicate", None]:
"""Return enum instance corresponding to input relation string."""

for pred in Predicate:
if relation.upper() in (
pred.value.fortran,
Expand All @@ -75,8 +74,8 @@ def to_int(value: Any) -> int:

Args:
value: value to coerce
"""

"""
if isinstance(value, (bool, int)):
return int(value)
return int(str(value)) # kick out floats
9 changes: 9 additions & 0 deletions acapy_agent/anoncreds/models/revocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(
tails_location: Tails file location
tails_hash: Tails file hash
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.public_keys = public_keys
Expand Down Expand Up @@ -100,6 +101,7 @@ def __init__(
tag: Tag
value: Rev Reg Def Value
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.issuer_id = issuer_id
Expand Down Expand Up @@ -178,6 +180,7 @@ def __init__(
state: State
revocation_registry_definition_id: Rev Reg Definition ID
revocation_registry_definition: Rev Reg Definition

"""
self.state = state
self.revocation_registry_definition_id = revocation_registry_definition_id
Expand Down Expand Up @@ -240,6 +243,7 @@ def __init__(
registration_metadata: Registration metadata
revocation_registry_definition_metadata: Rev Reg Def metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.job_id = job_id
Expand Down Expand Up @@ -300,6 +304,7 @@ def __init__(
resolution_metadata: Resolution metadata
revocation_registry_metadata: Revocation Registry metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.revocation_registry = revocation_registry
Expand Down Expand Up @@ -349,6 +354,7 @@ def __init__(
current_accumulator: Current accumulator
timestamp: Timestamp
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.issuer_id = issuer_id
Expand Down Expand Up @@ -437,6 +443,7 @@ def __init__(
Args:
state: State
revocation_list: Revocation list

"""
self.state = state
self.revocation_list = revocation_list
Expand Down Expand Up @@ -490,6 +497,7 @@ def __init__(
registration_metadata: Registration metadata
revocation_list_metadata: Revocation list metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.job_id = job_id
Expand Down Expand Up @@ -541,6 +549,7 @@ def __init__(
resolution_metadata: Resolution metadata
revocation_registry_metadata: Rev Reg metadata
kwargs: Keyword arguments

"""
super().__init__(**kwargs)
self.revocation_list = revocation_list
Expand Down
3 changes: 3 additions & 0 deletions acapy_agent/anoncreds/models/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
name: Schema name
version: Schema version
kwargs: Addiiotnal keyword arguments

"""
super().__init__(**kwargs)
self.issuer_id = issuer_id
Expand Down Expand Up @@ -107,6 +108,7 @@ def __init__(
resolution_metadata: Resolution Metdata
schema_metadata: Schema Metadata
kwargs: Additional keyword arguments

"""
super().__init__(**kwargs)
self.schema_value = schema
Expand Down Expand Up @@ -223,6 +225,7 @@ def __init__(
registration_metadata: Registration Metdata
schema_metadata: Schema Metadata
kwargs: Additional keyword arguments

"""
super().__init__(**kwargs)
self.job_id = job_id
Expand Down
3 changes: 2 additions & 1 deletion acapy_agent/anoncreds/models/schema_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This class represents schema information for anoncreds."""
"""Schema information for AnonCreds."""

from typing import Optional

Expand All @@ -15,6 +15,7 @@ class AnonCredsSchemaInfo:
issuer_id (str): The identifier of the issuer.
name (Optional[str], optional): The name of the schema. Defaults to None.
version (Optional[str], optional): The version of the schema. Defaults to None.

"""

def __init__(
Expand Down
Loading
Loading