generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 455
Closed
Labels
parametersParameters utilityParameters utilitytypingStatic typing definition related issues (mypy, pyright, etc.)Static typing definition related issues (mypy, pyright, etc.)
Description
Static type checker used
pyright/pylance
AWS Lambda function runtime
3.10
Powertools for AWS Lambda (Python) version
2.29.1
Static type checker info
Argument of type "str | dict[Unknown, Unknown] | bytes" cannot be assigned to parameter "__x" of type "ConvertibleToInt" in function "new"
Code snippet
from aws_lambda_powertools.utilities.parameters import get_parameter
param_value = get_parameter("/My/Parameter")
param_as_int = int(param_value)
Possible Solution
I believe this is happening because the get_parameter
function can be configured via the transform
argument to convert the param into a dictionary (if the response if a JSON string) or bytes (if the response is a base64 encoded string).
The type annotation for the function return can be overloaded depending on what value is used for that argument.
Metadata
Metadata
Assignees
Labels
parametersParameters utilityParameters utilitytypingStatic typing definition related issues (mypy, pyright, etc.)Static typing definition related issues (mypy, pyright, etc.)
Type
Projects
Status
Shipped