Made updates to some template files.
Change-Id: Ib9ee0046f235040f647b975c78c618c6562501d6
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/templates/python_pgm_template b/templates/python_pgm_template
index fe32f67..9e70cbd 100644
--- a/templates/python_pgm_template
+++ b/templates/python_pgm_template
@@ -7,13 +7,6 @@
import sys
-# python puts the program's directory path in sys.path[0]. In other words,
-# the user ordinarily has no way to override python's choice of a module from
-# its own dir. We want to have that ability in our environment. However, we
-# don't want to break any established python modules that depend on this
-# behavior. So, we'll save the value from sys.path[0], delete it, import our
-# modules and then restore sys.path to its original value.
-
save_path_0 = sys.path[0]
del sys.path[0]
@@ -24,29 +17,20 @@
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
-###############################################################################
-# Create parser object to process command line parameters and args.
-
-# Create parser object.
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
description="%(prog)s will...",
formatter_class=argparse.RawTextHelpFormatter,
prefix_chars='-+')
-# Create arguments.
parser.add_argument(
'--whatever',
help='bla, bla.')
-# The stock_list will be passed to gen_get_options. We populate it with the
-# names of stock parm options we want. These stock parms are pre-defined by
-# gen_get_options.
+# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
-###############################################################################
-###############################################################################
def exit_function(signal_number=0,
frame=None):
@@ -62,10 +46,7 @@
qprint_pgm_footer()
-###############################################################################
-
-###############################################################################
def signal_handler(signal_number,
frame):
@@ -84,10 +65,7 @@
# when we received the signal.
exit(0)
-###############################################################################
-
-###############################################################################
def validate_parms():
r"""
@@ -101,22 +79,9 @@
return True
-###############################################################################
-
-###############################################################################
def main():
- r"""
- This is the "main" function. The advantage of having this function vs
- just doing this in the true mainline is that you can:
- - Declare local variables
- - Use "return" instead of "exit".
- - Indent 4 chars like you would in any function.
- This makes coding more consistent, i.e. it's easy to move code from here
- into a function and vice versa.
- """
-
if not gen_get_options(parser, stock_list):
return False
@@ -129,13 +94,8 @@
return True
-###############################################################################
-
-###############################################################################
# Main
if not main():
exit(1)
-
-###############################################################################