Skip to content

Commit

Permalink
Add comments for decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Feb 14, 2022
1 parent b9a86f8 commit a994ae5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ def before_request(self, endpoint):
:param endpoint [str]: [endpoint to server the route]
"""

# This inner function is basically a wrapper arround the closure(decorator)
# being returned.
# It takes in a handler and converts it in into a closure
# and returns the arguments.
# Arguments are returned as they could be modified by the middlewares.
def inner(handler):
# add handling for async functions
async def async_inner_handler(*args):
await handler(args)
return args
Expand All @@ -115,8 +119,12 @@ def after_request(self, endpoint):
:param endpoint [str]: [endpoint to server the route]
"""

# This inner function is basically a wrapper arround the closure(decorator)
# being returned.
# It takes in a handler and converts it in into a closure
# and returns the arguments.
# Arguments are returned as they could be modified by the middlewares.
def inner(handler):
# add handling for async functions
async def async_inner_handler(*args):
await handler(args)
return args
Expand Down

0 comments on commit a994ae5

Please sign in to comment.