Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rafrafek opened this issue Nov 20, 2024 · 2 comments · Fixed by #5602
Closed

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

rafrafek opened this issue Nov 20, 2024 · 2 comments · Fixed by #5602
Labels
triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.)

Comments

@rafrafek
Copy link
Contributor

rafrafek commented Nov 20, 2024

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.

@rafrafek rafrafek added triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.) labels Nov 20, 2024
@rafrafek
Copy link
Contributor Author

Addressed in my PR #5602

Copy link
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
Labels
triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.)
Projects
Status: Coming soon
Development

Successfully merging a pull request may close this issue.

1 participant