Skip to content

Static typing: ‎ApiGatewayResolver.resolve‎ is missing type annotations #5600

Closed
@rafrafek

Description

@rafrafek

Static type checker used

pyright/pylance

AWS Lambda function runtime

3.12

Powertools for AWS Lambda (Python) version

latest

Static type checker info

The ApiGatewayResolver.resolve‎ function definition provides type annotations for the returning value, but not for the arguments:

def resolve(self, event, context) -> dict[str, Any]:

Parameters are described inside the function in the docstring, but not incorporated into the function definition:

        Parameters
        ----------
        event: dict[str, Any]
            Event
        context: LambdaContext
            Lambda context
        Returns
        -------
        dict
            Returns the dict response
        """

Link to the line of code:
https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/event_handler/api_gateway.py#L2002

Code snippet

def resolve(
    event: Unknown,
    context: Unknown
) -> dict[str, Any]

Possible Solution

Add the annotations to the function definition in addition to adding them into the doc string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagePending triage from maintainerstypingStatic typing definition related issues (mypy, pyright, etc.)

    Type

    No type

    Projects

    Status

    Shipped

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions