

def parseArgs():
    '\n    Process command line args using argparse or if not available the optparse\n       in a backwards compatible way\n\n    Returns tuple of (args, remnants) where args is object with attributes\n       corresponding to named arguments and remnants is list of remaining\n       unnamed positional arguments\n    '
    try:
        from argparse import ArgumentParser as Parser
        Parser.add = Parser.add_argument
        Parser.add_group = Parser.add_argument_group
        Parser.parse = Parser.parse_known_args
    except ImportError as ex:
        from optparse import OptionParser as Parser
        Parser.add = Parser.add_option
        Parser.add_group = Parser.add_option_group
        Parser.parse = Parser.parse_args
    d = 'Runs localhost web application wsgi service on given host address and port. '
    d += '\nDefault host:port is 0.0.0.0:8080.'
    d += '\n(0.0.0.0 is any interface on localhost)'
    p = Parser(description=d)
    d.add('-l', '--level', action='store', default='info', choices=aiding.LOGGING_LEVELS.keys(), help='Logging level.')
    p.add('-s', '--server', action='store', default='paste', help='Web application WSGI server type.')
    p.add('-a', '--host', action='store', default='0.0.0.0', help='Web application WSGI server ip host address.')
    p.add('-p', '--port', action='store', default='8080', help='Web application WSGI server ip port.')
    p.add('-b', '--base', action='store', default='', help='Base Url path prefix for client side web application.')
    p.add('-x', '--cors', action='store_true', default=False, help='Enable CORS Cross Origin Resource Sharing on server.')
    p.add('-t', '--tls', action='store_true', default=False, help='Use TLS/SSL (https).')
    p.add('-c', '--cert', action='store', default='/etc/pki/tls/certs/localhost.crt', help='File path to tls/ssl cacert certificate file.')
    p.add('-k', '--key', action='store', default='/etc/pki/tls/certs/localhost.key', help='File path to tls/ssl private key file.')
    p.add('-e', '--pem', action='store', default='/etc/pki/tls/certs/localhost.pem', help='File path to tls/ssl pem file with both cert and key.')
    p.add('-g', '--gen', action='store_true', default=False, help="Generate web app load file. Default is 'app/main.html' or if provided the file specified by -f option.")
    p.add('-f', '--load', action='store', default='app/main.html', help='Filepath to save generated web app load file upon -g option.')
    p.add('-C', '--coffee', action='store_true', default=False, help='Upon -g option generate to load coffeescript.')
    p.add('-d', '--devel', action='store_true', default=False, help='Development mode.')
    return p.parse()

dataset/ETHPy150Open saltstack/halite/halite/server_bottle.py parseArgs/VarMisuse@107/296 `p`->`d`