client_python
client_python copied to clipboard
add Timer decorator support partial function
When we use time to decorate a partial function, I get an cannot decorate partial function error. Should we use timer to support partial functions @hynek @csmarchbanks ? I thought it should be added and tried to add the relevant code.
Thank you for the PR! decorator.py
is actually copied from an old version of https://github.com/micheles/decorator, and we do not want to manually modify the contents. I would be ok updating to a newer version of decorator if it supports partial functions.
ok, I tried to submit a pr in the decorator.
#https://github.com/micheles/decorator/pull/150
Will this maybe as a side-effect solve issues with the decorator making an function untyped? (example attached)
mypy .
toolchain/prometheus_timetac_exporter.py:47:2: error: Untyped decorator makes function "collect_ttqueue_oldest_pending_job_timestamp" untyped [misc]
@METRIC_QUERY_RESULT_TIME.time()
^
Found 1 error in 1 file (checked 16 source files)
make: *** [lint] Error 1
Currently I've solved this via a # type: ignore
directive.