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.

Activity

added
triagePending triage from maintainers
typingStatic typing definition related issues (mypy, pyright, etc.)
on Nov 20, 2024
rafrafek

rafrafek commented on Nov 20, 2024

@rafrafek
ContributorAuthor

Addressed in my PR #5602

github-actions

github-actions commented on Nov 21, 2024

@github-actions
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Participants

      @rafrafek

      Issue actions

        Static typing: ‎`ApiGatewayResolver.resolve`‎ is missing type annotations · Issue #5600 · aws-powertools/powertools-lambda-python