diff mbox series

[3/3] rteval/server: edited files to use optparse instead of argparse

Message ID 20230628195145.636652-4-ashelat@redhat.com
State New
Headers show
Series Updates for converting optparse to argparse in | expand

Commit Message

Anubhav Shelat June 28, 2023, 7:51 p.m. UTC
rteval/server: edited files to use optparse instead of argparse.
Note: Since server is diabled, these changes have not been tested.

Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
---
 server/remove_rtevalrun          | 16 ++++++++--------
 server/rteval_testserver.py      |  1 -
 server/testclient_sendreportfile | 10 +++++-----
 3 files changed, 13 insertions(+), 14 deletions(-)

Comments

John Kacur June 28, 2023, 8:41 p.m. UTC | #1
On Wed, 28 Jun 2023, Anubhav Shelat wrote:

> rteval/server: edited files to use optparse instead of argparse.
> Note: Since server is diabled, these changes have not been tested.
> 
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> ---
>  server/remove_rtevalrun          | 16 ++++++++--------
>  server/rteval_testserver.py      |  1 -
>  server/testclient_sendreportfile | 10 +++++-----
>  3 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/server/remove_rtevalrun b/server/remove_rtevalrun
> index cee699e27c9f..7d83f71ea644 100755
> --- a/server/remove_rtevalrun
> +++ b/server/remove_rtevalrun
> @@ -29,7 +29,7 @@
>  
>  import sys
>  import getpass
> -from optparse import OptionParser
> +from argparse import ArgumentParser
>  from database import Database
>  
>  def do_delete(dbc, table, rterid):
> @@ -45,20 +45,20 @@ def do_delete(dbc, table, rterid):
>  
>  
>  if __name__ == '__main__':
> -    parser = OptionParser(version="%prog v0.1")
> +    parser = ArgumentParser(version="%prog v0.1")
>  
> -    parser.add_option("-H", "--host", action="store", dest="dbhost", default="localhost",
> +    parser.add_argument("-H", "--host", action="store", dest="dbhost", default="localhost",
>                        help="Database server to connect to (default: %default)",
>                        metavar="HOST")
> -    parser.add_option("-p", "--port", action="store", dest="dbport", default="5432",
> +    parser.add_argument("-p", "--port", action="store", dest="dbport", default="5432",
>                        help="Database server port to use (default: %default)", metavar="PORT")
> -    parser.add_option("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
> +    parser.add_argument("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
>                        help="Database user to connect as (default: %default)", metavar="USERNAME")
> -    parser.add_option("-d", "--database", action="store", dest="dbname", default="rteval",
> +    parser.add_argument("-d", "--database", action="store", dest="dbname", default="rteval",
>                        help="Database to use (default: %default)", metavar="DATABASE")
> -    parser.add_option("-r", "--rterid", action="store", dest="rterid", default=None,
> +    parser.add_argument("-r", "--rterid", action="store", dest="rterid", default=None,
>                        help="rteval run id to remove from the database", metavar="INTEGER")
> -    (opts, args) = parser.parse_args()
> +    opts = parser.parse_args()
>  
>      if opts.rterid is None:
>          print "%s:  Missing --rterid value" % sys.argv[0]
> diff --git a/server/rteval_testserver.py b/server/rteval_testserver.py
> index 6cac85bcfe52..c7f9ce954b21 100644
> --- a/server/rteval_testserver.py
> +++ b/server/rteval_testserver.py
> @@ -30,7 +30,6 @@ import sys
>  import signal
>  from xmlrpc.server import SimpleXMLRPCServer
>  from xmlrpc.server import SimpleXMLRPCRequestHandler
> -from optparse import OptionParser
>  import argparse
>  
>  import xmlrpc_API1
> diff --git a/server/testclient_sendreportfile b/server/testclient_sendreportfile
> index 08317b263f76..dc69a199122c 100755
> --- a/server/testclient_sendreportfile
> +++ b/server/testclient_sendreportfile
> @@ -28,22 +28,22 @@
>  
>  import sys
>  import libxml2
> -from optparse import OptionParser
> +from argparse import ArgumentParser
>  
>  sys.path.append('../rteval')
>  import rtevalclient
>  
>  if __name__ == '__main__':
> -    parser = OptionParser(version="%prog v0.1")
> +    parser = ArgumentParser(version="%prog v0.1")
>  
> -    parser.add_option("-r", "--report", action="store", dest="report", default="summary.xml",
> +    parser.add_argument("-r", "--report", action="store", dest="report", default="summary.xml",
>                        help="Which XML report to send to the XML-RPC server  (default: %default)",
>                        metavar="FILE")
> -    parser.add_option("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
> +    parser.add_argument("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
>                        help="Hostname to the XML-RPC server to send the data (default: %default)",
>                        metavar="HOST[:PORT]")
>  
> -    (opts, args) = parser.parse_args()
> +    opts = parser.parse_args()
>  
>      d = libxml2.parseFile(opts.report)
>  
> -- 
> 2.39.3
> 
> 
    - Fixed spelling in commit comments
    Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/server/remove_rtevalrun b/server/remove_rtevalrun
index cee699e27c9f..7d83f71ea644 100755
--- a/server/remove_rtevalrun
+++ b/server/remove_rtevalrun
@@ -29,7 +29,7 @@ 
 
 import sys
 import getpass
-from optparse import OptionParser
+from argparse import ArgumentParser
 from database import Database
 
 def do_delete(dbc, table, rterid):
@@ -45,20 +45,20 @@  def do_delete(dbc, table, rterid):
 
 
 if __name__ == '__main__':
-    parser = OptionParser(version="%prog v0.1")
+    parser = ArgumentParser(version="%prog v0.1")
 
-    parser.add_option("-H", "--host", action="store", dest="dbhost", default="localhost",
+    parser.add_argument("-H", "--host", action="store", dest="dbhost", default="localhost",
                       help="Database server to connect to (default: %default)",
                       metavar="HOST")
-    parser.add_option("-p", "--port", action="store", dest="dbport", default="5432",
+    parser.add_argument("-p", "--port", action="store", dest="dbport", default="5432",
                       help="Database server port to use (default: %default)", metavar="PORT")
-    parser.add_option("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
+    parser.add_argument("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
                       help="Database user to connect as (default: %default)", metavar="USERNAME")
-    parser.add_option("-d", "--database", action="store", dest="dbname", default="rteval",
+    parser.add_argument("-d", "--database", action="store", dest="dbname", default="rteval",
                       help="Database to use (default: %default)", metavar="DATABASE")
-    parser.add_option("-r", "--rterid", action="store", dest="rterid", default=None,
+    parser.add_argument("-r", "--rterid", action="store", dest="rterid", default=None,
                       help="rteval run id to remove from the database", metavar="INTEGER")
-    (opts, args) = parser.parse_args()
+    opts = parser.parse_args()
 
     if opts.rterid is None:
         print "%s:  Missing --rterid value" % sys.argv[0]
diff --git a/server/rteval_testserver.py b/server/rteval_testserver.py
index 6cac85bcfe52..c7f9ce954b21 100644
--- a/server/rteval_testserver.py
+++ b/server/rteval_testserver.py
@@ -30,7 +30,6 @@  import sys
 import signal
 from xmlrpc.server import SimpleXMLRPCServer
 from xmlrpc.server import SimpleXMLRPCRequestHandler
-from optparse import OptionParser
 import argparse
 
 import xmlrpc_API1
diff --git a/server/testclient_sendreportfile b/server/testclient_sendreportfile
index 08317b263f76..dc69a199122c 100755
--- a/server/testclient_sendreportfile
+++ b/server/testclient_sendreportfile
@@ -28,22 +28,22 @@ 
 
 import sys
 import libxml2
-from optparse import OptionParser
+from argparse import ArgumentParser
 
 sys.path.append('../rteval')
 import rtevalclient
 
 if __name__ == '__main__':
-    parser = OptionParser(version="%prog v0.1")
+    parser = ArgumentParser(version="%prog v0.1")
 
-    parser.add_option("-r", "--report", action="store", dest="report", default="summary.xml",
+    parser.add_argument("-r", "--report", action="store", dest="report", default="summary.xml",
                       help="Which XML report to send to the XML-RPC server  (default: %default)",
                       metavar="FILE")
-    parser.add_option("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
+    parser.add_argument("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
                       help="Hostname to the XML-RPC server to send the data (default: %default)",
                       metavar="HOST[:PORT]")
 
-    (opts, args) = parser.parse_args()
+    opts = parser.parse_args()
 
     d = libxml2.parseFile(opts.report)