From a7c10dde4ad7bc88a63f2f5805049fc29d5cf8b1 Mon Sep 17 00:00:00 2001 From: dni Date: Mon, 25 Jul 2022 13:13:50 +0200 Subject: [PATCH] fixup types --- .github/workflows/mypy.yml | 2 +- lnbits/core/views/generic.py | 13 +++++++------ lnbits/decorators.py | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index bf90a8e3..71713d88 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -10,4 +10,4 @@ jobs: - uses: jpetrucciani/mypy-check@master with: mypy_flags: '--install-types --non-interactive' - path: lnbits + path: 'lnbits' diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index 01bc47b6..433c6f62 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -55,9 +55,9 @@ async def home(request: Request, lightning: str = None): ) async def extensions( request: Request, - user=Depends(check_user_exists), - enable=Query(None), - disable=Query(None), + user: User = Depends(check_user_exists), #type: ignore + enable: str = Query(None), #type: ignore + disable: str = Query(None), #type: ignore ): extension_to_enable = enable extension_to_disable = disable @@ -108,11 +108,12 @@ just **user_id**: return the first user wallet or create one if none found (with nothing: create everything
""", ) + async def wallet( request=Query(None), - nme=Query(None), - usr=Query(None), - wal=Query(None), + nme: Optional[str] = Query(None), #type: ignore + usr: Optional[UUID4] = Query(None), #type: ignore + wal: Optional[UUID4] = Query(None), #type: ignore ): user_id = usr.hex if usr else None wallet_id = wal.hex if wal else None diff --git a/lnbits/decorators.py b/lnbits/decorators.py index 9f51ce64..b65c43a1 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -122,8 +122,8 @@ api_key_query = APIKeyQuery( async def get_key_type( r: Request, - api_key_header=Security(api_key_header), - api_key_query=Security(api_key_query), + api_key_header: str = Security(api_key_header), #type: ignore + api_key_query: str = Security(api_key_query) #type: ignore ) -> WalletTypeInfo: # 0: admin # 1: invoice @@ -180,8 +180,8 @@ async def get_key_type( async def require_admin_key( r: Request, - api_key_header=Security(api_key_header), - api_key_query=Security(api_key_query), + api_key_header: str = Security(api_key_header), #type: ignore + api_key_query: str = Security(api_key_query) #type: ignore ): token = api_key_header if api_key_header else api_key_query @@ -199,8 +199,8 @@ async def require_admin_key( async def require_invoice_key( r: Request, - api_key_header=Security(api_key_header), - api_key_query=Security(api_key_query), + api_key_header: str = Security(api_key_header), #type: ignore + api_key_query: str = Security(api_key_query) #type: ignore ): token = api_key_header if api_key_header else api_key_query