From 2687ff1d39d216d8bcb7157b992e02cacd310eab Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sat, 29 Apr 2023 17:38:07 +0200 Subject: [PATCH] Correct custom fetch callback examples --- docs/usage.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 77a9eec..703cadd 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -254,7 +254,7 @@ The function calls are converted to appropriate values and mapped to their librr ] def my_callback(filename, cf, start, end, step): - itemcount = (end - start) / step + itemcount = math.ceil((end - start) / step) return { 'start': start, 'step': 300, @@ -265,8 +265,8 @@ The function calls are converted to appropriate values and mapped to their librr } } - rrdtool.register_fetch_cb(my_callable) - rrdtool.graphv(**graphv_args) + rrdtool.register_fetch_cb(my_callback) + rrdtool.graphv(*graphv_args) # also works with callable objects class MyCallable(object): @@ -276,7 +276,7 @@ The function calls are converted to appropriate values and mapped to their librr cb = MyCallable() rrdtool.register_fetch_cb(cb) # overwrite callback - rrdtool.graphv(**graphv_args) + rrdtool.graphv(*graphv_args) .. note:: This function uses Python long integers on Python 2.x and 3.x to minimize compatibility code requirements (Python 3 has long integers as its default int anyway). @@ -381,4 +381,4 @@ python-rrdtool will raise exceptions in the event of errors. Raised in the event of errors generated by rrdtool itself. -Both exception classes are directly derived from the ``Exception`` class. \ No newline at end of file +Both exception classes are directly derived from the ``Exception`` class.