@@ -434,8 +434,8 @@ async def _create_authorization_for_new_api_key(self, auth: APIKeyAuthorization)
434434 return await self ._create_authorization (
435435 identity_id = "" , # setting `identity_id` when creating an API key results in an error
436436 identity_type = "api-key" ,
437- role = auth ._role ,
438- resource_type = auth ._resource_type ,
437+ role = auth ._role , # type: ignore -- Ignoring because this is technically a `string`
438+ resource_type = auth ._resource_type , # type: ignore -- Ignoring because this is technically a `string`
439439 resource_id = auth ._resource_id ,
440440 )
441441
@@ -1282,7 +1282,7 @@ async def list_authorizations(self, resource_ids: Optional[List[str]] = None) ->
12821282 response : ListAuthorizationsResponse = await self ._app_client .ListAuthorizations (request , metadata = self ._metadata )
12831283 return list (response .authorizations )
12841284
1285- async def check_permissions (self , permissions : [ List [AuthorizedPermissions ] ]) -> List [AuthorizedPermissions ]:
1285+ async def check_permissions (self , permissions : List [AuthorizedPermissions ]) -> List [AuthorizedPermissions ]:
12861286 """Checks validity of a list of permissions.
12871287
12881288 Args:
@@ -1369,9 +1369,10 @@ async def upload_module_file(self, module_file_info: Optional[ModuleFileInfo], f
13691369 async with self ._app_client .UploadModuleFile .open (metadata = self ._metadata ) as stream :
13701370 await stream .send_message (request_module_file_info )
13711371 await stream .send_message (request_file , end = True )
1372- response = await stream .recv_message ()
1372+ response : Union [ UploadModuleFileRequest , None ] = await stream .recv_message ()
13731373 if not response :
13741374 await stream .recv_trailing_metadata () # causes us to throw appropriate gRPC error.
1375+ raise TypeError ("Response cannot be empty" ) # we should never get here, but for typechecking
13751376 return response .url
13761377
13771378 async def get_module (self , module_id : str ) -> Module :
@@ -1418,8 +1419,8 @@ async def create_key(self, authorizations: List[APIKeyAuthorization], name: Opti
14181419 Tuple[str, str]: The api key and api key ID.
14191420 """
14201421 name = name if name is not None else str (datetime .now ())
1421- authorizationspb = [await self ._create_authorization_for_new_api_key (auth ) for auth in authorizations ]
1422- request = CreateKeyRequest (authorizations = authorizationspb , name = name )
1422+ authorizations_pb = [await self ._create_authorization_for_new_api_key (auth ) for auth in authorizations ]
1423+ request = CreateKeyRequest (authorizations = authorizations_pb , name = name )
14231424 response : CreateKeyResponse = await self ._app_client .CreateKey (request , metadata = self ._metadata )
14241425 return (response .key , response .id )
14251426
@@ -1447,4 +1448,4 @@ async def list_keys(self) -> List[APIKeyWithAuthorizations]:
14471448 org_id = await self ._get_organization_id ()
14481449 request = ListKeysRequest (org_id = org_id )
14491450 response : ListKeysResponse = await self ._app_client .ListKeys (request , metadata = self ._metadata )
1450- return [ key for key in response .api_keys ]
1451+ return list ( response .api_keys )
0 commit comments