def parse_args(filepath=__file__, source=sys.argv, custom_commands=[]):
    global original_args
    original_args = sys.argv[:]

    defaults = {
        'myself': source.pop(0),
        'hostname': 'localhost',
        'port': 9000,
        'conf': 'app/config/settings.py'
    }
    if len(source) == 0:
        source.append(defaults['myself'])

    parser = argparse.ArgumentParser(
        description='Example: {myself} -h {hostname}' +
                    '-p {port} -c config/devel.py start'.format(
                        **defaults), conflict_handler='resolve')
    parser.add_argument('command', choices=[
                        'start', 'stop', 'restart', 'status', 'runserver'] + custom_commands)
    parser.add_argument('-h', '--hostname', default=defaults['hostname'])
    parser.add_argument('-p', '--port', type=int, default=defaults['port'])
    parser.add_argument(
        '-c', '--config', required=False, default=defaults['conf'], type=argparse.FileType(),
        help='config must match the location of a module containing' +
             'decanter required configuration items, i.e. app/config/settings.py')
    args = parser.parse_args(source)

    # 'type=argparse.FileType()' will confirm the existence of a file.
    # but it open file.
    args.config.close()
    args.config = os.path.relpath(os.path.realpath(args.config.name),
                                  os.path.dirname(os.path.realpath(filepath)))
    return args
Make the result appear empty if there are no updates. This is used
dataset/ETHPy150Open gengo/decanter/decanter/decanter.py/parse_args--crossover with--dataset/ETHPy150Open matrix-org/synapse/synapse/handlers/sync.py/TimelineBatch.__nonzero__