-
Notifications
You must be signed in to change notification settings - Fork 403
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: APIGatewayRestResolver .post()
decorator return type Unknown
#3990
Labels
help wanted
Could use a second pair of eyes/hands
revisit-in-3-months
Requires more customers feedback before making or revisiting a decision
typing
Static typing definition related issues (mypy, pyright, etc.)
Comments
rafrafek
added
triage
Pending triage from maintainers
typing
Static typing definition related issues (mypy, pyright, etc.)
labels
Mar 20, 2024
github-project-automation
bot
moved this to Triage
in Powertools for AWS Lambda (Python)
Mar 20, 2024
I think the solution may look similar to this: from typing import Any, Callable, TypeVar
T_route = TypeVar("T_route", bound=Callable[..., Any])
class Resolver:
def route(self, rule: str, method: str) -> Callable[[T_route], T_route]:
def register_resolver(func: T_route) -> T_route:
print(rule, method)
return func
return register_resolver
def post(self, rule: str) -> Callable[[T_route], T_route]:
return self.route(rule=rule, method="POST")
app = Resolver()
@app.route("/v1/demo", "GET")
def demo() -> str:
return "demo"
@app.post("/v1/demo_post")
def demo_post() -> str:
return "demo post" |
Hello @rafrafek! Thanks for opening this issue! I'm planning to review this next week. |
leandrodamascena
moved this from Triage
to Pending review
in Powertools for AWS Lambda (Python)
Mar 21, 2024
heitorlessa
added
help wanted
Could use a second pair of eyes/hands
triage
Pending triage from maintainers
labels
Jun 9, 2024
Adding help wanted label as we were unable to prioritize it. Any PR welcome <3 |
heitorlessa
moved this from Pending review
to Backlog
in Powertools for AWS Lambda (Python)
Jun 10, 2024
leandrodamascena
added
the
revisit-in-3-months
Requires more customers feedback before making or revisiting a decision
label
Aug 12, 2024
7 tasks
Created PR for this, appreciate reviewing it: #5601 |
7 tasks
github-project-automation
bot
moved this from Backlog
to Coming soon
in Powertools for AWS Lambda (Python)
Nov 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
help wanted
Could use a second pair of eyes/hands
revisit-in-3-months
Requires more customers feedback before making or revisiting a decision
typing
Static typing definition related issues (mypy, pyright, etc.)
Static type checker used
pyright/pylance
AWS Lambda function runtime
3.12
Powertools for AWS Lambda (Python) version
latest
Static type checker info
Latest Pylance, latest VS Code, type checking mode strict.
Screenshot:
Code snippet
Possible Solution
return
Callable[..., T]
or something like thatThe text was updated successfully, but these errors were encountered: