From 0ce53e13fa482b43b2d32ce4f050b568e2e0e7bb Mon Sep 17 00:00:00 2001 From: Hobbs Date: Thu, 12 Dec 2024 14:17:54 -0800 Subject: [PATCH] kvs: add rst format to inline docs Problem: on the web version of the docs, which are auto-generated, multiple lines of python appear on the same line, and are formatted weirdly. Add rst format to the inline docs. --- src/bindings/python/flux/kvs.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/bindings/python/flux/kvs.py b/src/bindings/python/flux/kvs.py index 20eb79b5ed7d..5bd4c817e9ed 100644 --- a/src/bindings/python/flux/kvs.py +++ b/src/bindings/python/flux/kvs.py @@ -385,8 +385,10 @@ class KVSTxn: Can be used as a context manager and commits will be handled at exit. e.g. - with KVSTxn(handle, "basedirectory") as kt: - kt.put("a", 1) + .. code-block:: + + with KVSTxn(handle, "basedirectory") as kt: + kt.put("a", 1) Args: flux_handle: A Flux handle obtained from flux.Flux() @@ -478,20 +480,24 @@ class KVSDir(WrapperPimpl, abc.MutableMapping): KVS values can be read or written through this class's item accessor. e.g. - mydir = KVSDir(flux_handle) - print(mydir["mykey"]) + .. code-block:: + + mydir = KVSDir(flux_handle) + print(mydir["mykey"]) - mydir["newkey"] = "foo" - mydir.commit() + mydir["newkey"] = "foo" + mydir.commit() Any KVS directories accessed through the item accessor will share the same internal KVS transaction, so that only a single call to commit() is necessary. e.g. - mydir = KVSDir(flux_handle) - subdir = mydir["subdir"] - subdir["anotherkey"] = "bar" - mydir.commit() + .. code-block:: + + mydir = KVSDir(flux_handle) + subdir = mydir["subdir"] + subdir["anotherkey"] = "bar" + mydir.commit() Args: flux_handle: A Flux handle obtained from flux.Flux() @@ -506,7 +512,6 @@ class KVSDir(WrapperPimpl, abc.MutableMapping): # pylint: disable=too-many-ancestors, too-many-public-methods class InnerWrapper(Wrapper): - # pylint: disable=no-value-for-parameter def __init__(self, flux_handle=None, path=".", handle=None, namespace=None): dest = RAW.flux_kvsdir_destroy