Skip to content

Commit

Permalink
style: format with black
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
  • Loading branch information
dbluhm committed Mar 28, 2022
1 parent 54dd0c7 commit e79a2e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
32 changes: 20 additions & 12 deletions aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,14 @@ def send_fn(self) -> Coroutine:
async def ready_middleware(request: web.BaseRequest, handler: Coroutine):
"""Only continue if application is ready to take work."""

if str(request.rel_url).rstrip("/") in (
"/status/live",
"/status/ready",
) or request.app._state.get("ready"):
if (
str(request.rel_url).rstrip("/")
in (
"/status/live",
"/status/ready",
)
or request.app._state.get("ready")
):
try:
return await handler(request)
except (LedgerConfigError, LedgerTransactionError) as e:
Expand Down Expand Up @@ -263,14 +267,18 @@ async def make_application(self) -> web.Application:
assert self.admin_insecure_mode ^ bool(self.admin_api_key)

def is_unprotected_path(path: str):
return path in [
"/api/doc",
"/api/docs/swagger.json",
"/favicon.ico",
"/ws", # ws handler checks authentication
"/status/live",
"/status/ready",
] or path.startswith("/static/swagger/")
return (
path
in [
"/api/doc",
"/api/docs/swagger.json",
"/favicon.ico",
"/ws", # ws handler checks authentication
"/status/live",
"/status/ready",
]
or path.startswith("/static/swagger/")
)

# If admin_api_key is None, then admin_insecure_mode must be set so
# we can safely enable the admin server with no security
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/messaging/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


LOGGER = logging.getLogger(__name__)
I32_BOUND = 2**31
I32_BOUND = 2 ** 31


def datetime_to_str(dt: Union[str, datetime]) -> str:
Expand Down
14 changes: 5 additions & 9 deletions aries_cloudagent/wallet/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
)
from ..protocols.endorse_transaction.v1_0.util import (
is_author_role,
get_endorser_connection_id
get_endorser_connection_id,
)
from ..storage.error import (StorageNotFoundError, StorageError)
from ..storage.error import StorageNotFoundError, StorageError

from .base import BaseWallet
from .did_info import DIDInfo
Expand Down Expand Up @@ -201,9 +201,7 @@ class CreateAttribTxnForEndorserOptionSchema(OpenAPISchema):
class AttribConnIdMatchInfoSchema(OpenAPISchema):
"""Path parameters and validators for request taking connection id."""

conn_id = fields.Str(
description="Connection identifier", required=False
)
conn_id = fields.Str(description="Connection identifier", required=False)


def format_did_info(info: DIDInfo):
Expand Down Expand Up @@ -454,8 +452,7 @@ async def wallet_set_public_did(request: web.BaseRequest):
transaction_mgr = TransactionManager(context.profile)
try:
transaction = await transaction_mgr.create_record(
messages_attach=attrib_def["signed_txn"],
connection_id=connection_id
messages_attach=attrib_def["signed_txn"], connection_id=connection_id
)
except StorageError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
Expand Down Expand Up @@ -674,8 +671,7 @@ async def wallet_set_did_endpoint(request: web.BaseRequest):
transaction_mgr = TransactionManager(context.profile)
try:
transaction = await transaction_mgr.create_record(
messages_attach=attrib_def["signed_txn"],
connection_id=connection_id
messages_attach=attrib_def["signed_txn"], connection_id=connection_id
)
except StorageError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
Expand Down

0 comments on commit e79a2e4

Please sign in to comment.