Skip to content

Commit 9303176

Browse files
author
Michael Brewer
committed
refactor: remove extra wrapping
1 parent 8ecae20 commit 9303176

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import zlib
99
from abc import ABC, abstractmethod
1010
from enum import Enum
11-
from functools import partial, wraps
11+
from functools import partial
1212
from http import HTTPStatus
1313
from typing import Any, Callable, Dict, List, Optional, Set, Union
1414

@@ -669,7 +669,7 @@ def include_router(self, router: "Router", prefix: Optional[str] = None) -> None
669669
rule = prefix if rule == "/" else f"{prefix}{rule}"
670670
route = (rule, *route[1:])
671671

672-
self.route(*route)(func())
672+
self.route(*route)(func)
673673

674674

675675
class Router(BaseRouter):
@@ -696,18 +696,11 @@ def route(
696696
compress: bool = False,
697697
cache_control: Optional[str] = None,
698698
):
699-
def actual_decorator(func: Callable):
700-
@wraps(func)
701-
def wrapper():
702-
def inner_wrapper(**kwargs):
703-
return func(**kwargs)
704-
705-
return inner_wrapper
706-
699+
def register_route(func: Callable):
707700
if isinstance(method, (list, tuple)):
708701
for item in method:
709-
self.routes[(rule, item, cors, compress, cache_control)] = wrapper
702+
self.routes[(rule, item, cors, compress, cache_control)] = func
710703
else:
711-
self.routes[(rule, method, cors, compress, cache_control)] = wrapper
704+
self.routes[(rule, method, cors, compress, cache_control)] = func
712705

713-
return actual_decorator
706+
return register_route

0 commit comments

Comments
 (0)