You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
867 B
Python
30 lines
867 B
Python
def wraps(original_handler):
|
|
"""
|
|
Esse decorator faz com que a assinatura da função original
|
|
"suba" até o último decorator, que deverá ser sempre um registrador do
|
|
próprio amqpworker. ex:
|
|
@app.http.get(...)
|
|
@deco1
|
|
@deco2
|
|
async def handler(...)
|
|
pass
|
|
|
|
Nesse caso, os decorators `@deco1` e `@deco2` devem, *necessariamente*
|
|
fazer uso desse `@wraps()`
|
|
"""
|
|
|
|
def _wrap(deco):
|
|
deco.amqpworker_original_annotations = getattr(
|
|
original_handler,
|
|
"amqpworker_original_annotations",
|
|
original_handler.__annotations__,
|
|
)
|
|
deco.amqpworker_original_qualname = getattr(
|
|
original_handler,
|
|
"amqpworker_original_qualname",
|
|
original_handler.__qualname__,
|
|
)
|
|
return deco
|
|
|
|
return _wrap
|