pcp
[Top] [All Lists]

Deprecate Python pmNonOptionsFromList()

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: Deprecate Python pmNonOptionsFromList()
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Mon, 30 Nov 2015 18:25:46 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: myllynen@xxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
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

<Prev in Thread] Current Thread [Next in Thread>
  • Deprecate Python pmNonOptionsFromList(), Marko Myllynen <=