[pcp] Deprecate Python pmNonOptionsFromList()

Marko Myllynen myllynen at redhat.com
Mon Nov 30 10:25:46 CST 2015


Hi,

the Python method to get non-options from the command line is
particularly well-hidden, unlike all the other pmGet* and pmSet* methods
it doesn't follow the common naming convention but is
pmNonOptionsFromList() and it's also in the middle of the pmSet* methods.

The below patch makes it less hidden by moving it near other pmGet*
methods, adding pmGetNonOptionsFromList() and marking the current
pmNonOptionsFromList() as deprecated.

---
 src/python/pcp/pmapi.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/python/pcp/pmapi.py b/src/python/pcp/pmapi.py
index f9805a7..8c7ad08 100644
--- a/src/python/pcp/pmapi.py
+++ b/src/python/pcp/pmapi.py
@@ -766,6 +766,13 @@ class pmOptions(object):
     ##
     # general command line option access and manipulation

+    def pmGetNonOptionsFromList(self, argv):
+        return c_api.pmGetNonOptionsFromList(argv)
+
+    # Deprecated, use pmGetNonOptionsFromList() above instead
+    def pmNonOptionsFromList(self, argv):
+        return c_api.pmGetNonOptionsFromList(argv)
+
     def pmGetOptionFlags(self):
         return c_api.pmGetOptionFlags()

@@ -793,9 +800,6 @@ class pmOptions(object):
         """ Set sampling interval (pmParseInterval string) """
         return c_api.pmSetOptionInterval(interval)

-    def pmNonOptionsFromList(self, argv):
-        return c_api.pmGetNonOptionsFromList(argv)
-
     def pmSetCallbackObject(self, them):
         """ When options are being parsed from within an object, the
             caller will want the "self" of the other object ("them")

Thanks,

-- 
Marko Myllynen



More information about the pcp mailing list