Skip to content

Commit cfacb07

Browse files
authored
Merge pull request #3900 from didx-xyz/update-ruff-lint-rules
🔧 🎨 Revise lint rules
2 parents e346ce8 + f4fac5b commit cfacb07

File tree

298 files changed

+462
-581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+462
-581
lines changed

.github/workflows/format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
- name: Ruff Format Check
2323
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1.0.0
2424
with:
25-
version: 0.12.10
25+
version: 0.13.3
2626
args: "format --check"
2727
- name: Ruff Lint Check
2828
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1.0.0
2929
with:
30-
version: 0.12.10
30+
version: 0.13.3
3131
args: "check"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
additional_dependencies: ['@commitlint/config-conventional']
99
- repo: https://github.com/astral-sh/ruff-pre-commit
1010
# Ensure this is synced with pyproject.toml
11-
rev: v0.12.10
11+
rev: v0.13.3
1212
hooks:
1313
# Run the linter
1414
- id: ruff

acapy_agent/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
def init_debug(args):
1111
"""Initialize debugging environment."""
12-
1312
ENABLE_PTVSD = os.getenv("ENABLE_PTVSD", "").lower()
1413
ENABLE_PTVSD = ENABLE_PTVSD and ENABLE_PTVSD not in ("false", "0")
1514

acapy_agent/admin/server.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ async def send_outbound(
105105
Args:
106106
message: The `OutboundMessage` to be sent
107107
**kwargs: Additional keyword arguments
108+
108109
"""
109110
profile = self._profile()
110111
if not profile:
@@ -117,6 +118,7 @@ async def send_webhook(self, topic: str, payload: dict):
117118
Args:
118119
topic: the webhook topic identifier
119120
payload: the webhook payload value
121+
120122
"""
121123
warnings.warn(
122124
"responder.send_webhook is deprecated; please use the event bus instead.",
@@ -136,7 +138,6 @@ def send_fn(self) -> Coroutine:
136138
@web.middleware
137139
async def ready_middleware(request: web.BaseRequest, handler: Coroutine):
138140
"""Only continue if application is ready to take work."""
139-
140141
is_status_check = str(request.rel_url).rstrip("/") in status_paths
141142
is_app_ready = request.app._state.get("ready")
142143

@@ -241,7 +242,6 @@ async def upgrade_middleware(request: web.BaseRequest, handler: Coroutine):
241242
@web.middleware
242243
async def debug_middleware(request: web.BaseRequest, handler: Coroutine):
243244
"""Show request detail in debug log."""
244-
245245
if LOGGER.isEnabledFor(logging.DEBUG): # Skipped if DEBUG is not enabled
246246
LOGGER.debug("Incoming request: %s %s", request.method, request.path_qs)
247247
is_status_check = str(request.rel_url).startswith("/status/")
@@ -282,6 +282,7 @@ def __init__(
282282
conductor_stop (Coroutine): Conductor (graceful) stop for shutdown API call.
283283
task_queue (TaskQueue, optional): An optional task queue for handlers.
284284
conductor_stats (Coroutine, optional): Conductor statistics API call.
285+
285286
"""
286287
self.app = None
287288
self.admin_api_key = context.settings.get("admin.admin_api_key")
@@ -302,7 +303,6 @@ def __init__(
302303

303304
async def make_application(self) -> web.Application:
304305
"""Get the aiohttp application instance."""
305-
306306
middlewares = [ready_middleware, debug_middleware]
307307

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

567567
async def websocket_handler(self, request):
568568
"""Send notifications to admin client over websocket."""
569-
570569
ws = web.WebSocketResponse()
571570
await ws.prepare(request)
572571
socket_id = str(uuid4())

acapy_agent/anoncreds/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(
5959
obj (T, optional): The generic object associated with the instance.
6060
*args: Variable length argument list.
6161
**kwargs: Arbitrary keyword arguments.
62+
6263
"""
6364
super().__init__(message, obj_id, obj, *args, **kwargs)
6465
self._message = message

acapy_agent/anoncreds/default/legacy_indy/recover.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ async def fetch_txns(
5252
set[int],
5353
]:
5454
"""Fetch tails file and revocation registry information."""
55-
5655
LOGGER.debug(f"Fetch revocation registry def {registry_id} from ledger")
5756
revoc_reg_delta_request = indy_vdr.ledger.build_get_revoc_reg_def_request(
5857
None, registry_id
@@ -92,7 +91,6 @@ async def fetch_txns(
9291

9392
async def generate_ledger_rrrecovery_txn(genesis_txns: str, rev_list: RevList) -> dict:
9493
"""Generate a new ledger accum entry, using the wallet value if revocations ahead of ledger.""" # noqa: E501
95-
9694
registry_from_ledger, prev_revoked = await fetch_txns(
9795
genesis_txns, rev_list.rev_reg_def_id, rev_list.issuer_id
9896
)

acapy_agent/anoncreds/default/legacy_indy/registry.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def make_rev_reg_def_id(rev_reg_def: RevRegDef) -> str:
175175

176176
async def get_schema(self, profile: Profile, schema_id: str) -> GetSchemaResult:
177177
"""Get a schema from the registry."""
178-
179178
multitenant_mgr = profile.inject_or(BaseMultitenantManager)
180179
if multitenant_mgr:
181180
ledger_exec_inst = IndyLedgerRequestsExecutor(profile)
@@ -333,7 +332,6 @@ async def get_credential_definition(
333332
self, profile: Profile, cred_def_id: str
334333
) -> GetCredDefResult:
335334
"""Get a credential definition from the registry."""
336-
337335
async with profile.session() as session:
338336
multitenant_mgr = session.inject_or(BaseMultitenantManager)
339337
if multitenant_mgr:
@@ -1211,7 +1209,6 @@ async def txn_submit(
12111209
write_ledger: bool = True,
12121210
) -> str:
12131211
"""Submit a transaction to the ledger."""
1214-
12151212
try:
12161213
async with ledger:
12171214
return await shield(

acapy_agent/anoncreds/events.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(
3737
3838
Args:
3939
payload: CredDefFinishedPayload
40+
4041
"""
4142
self._topic = CRED_DEF_FINISHED_EVENT
4243
self._payload = payload
@@ -84,6 +85,7 @@ def __init__(self, payload: RevRegDefFinishedPayload):
8485
8586
Args:
8687
payload: RevRegDefFinishedPayload
88+
8789
"""
8890
self._topic = REV_REG_DEF_FINISHED_EVENT
8991
self._payload = payload
@@ -121,6 +123,7 @@ def __init__(self, payload: RevListFinishedPayload):
121123
122124
Args:
123125
payload: RevListFinishedPayload
126+
124127
"""
125128
self._topic = REV_LIST_FINISHED_EVENT
126129
self._payload = payload

acapy_agent/anoncreds/holder.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def profile(self) -> AskarAnonCredsProfile:
8787

8888
async def get_master_secret(self) -> str:
8989
"""Get or create the default master secret."""
90-
9190
while True:
9291
async with self.profile.session() as session:
9392
try:
@@ -381,7 +380,6 @@ async def get_credentials(self, *, offset: int, limit: int, wql: dict) -> list[d
381380
wql: wql query dict
382381
383382
"""
384-
385383
result = []
386384

387385
try:
@@ -526,6 +524,7 @@ async def credential_revoked(
526524
527525
Returns:
528526
bool: True if the credential is revoked, False otherwise.
527+
529528
"""
530529
cred = await self._get_credential(credential_id)
531530
rev_reg_id = cred.rev_reg_id
@@ -604,7 +603,6 @@ async def create_presentation(
604603
rev_states: AnonCreds format revocation states JSON
605604
606605
"""
607-
608606
creds: Dict[str, Credential] = {}
609607

610608
def get_rev_state(cred_id: str, detail: dict):
@@ -750,7 +748,6 @@ async def create_revocation_state(
750748
the revocation state
751749
752750
"""
753-
754751
try:
755752
rev_state = await asyncio.get_event_loop().run_in_executor(
756753
None,

acapy_agent/anoncreds/issuer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ async def credential_definition_in_wallet(
272272
273273
Args:
274274
credential_definition_id: The credential definition ID to check
275+
275276
"""
276277
try:
277278
async with self.profile.session() as session:

0 commit comments

Comments
 (0)