wkhtmltopdf/utils.py
def _options_to_args(**options):
    """
    Converts ``options`` into a list of command-line arguments.
    Skip arguments where no value is provided
    For flag-type (No argument) variables, pass only the name and only then if the value is True
    """
    flags = []
    for name in sorted(options):
        value = options[name]
        formatted_flag = '--%s' % name if len(name) > 1 else '-%s' % name
        formatted_flag = formatted_flag.replace('_', '-')
        accepts_no_arguments = formatted_flag in NO_ARGUMENT_OPTIONS
        if value is None or (value is False and accepts_no_arguments):
            continue
        flags.append(formatted_flag)
        if accepts_no_arguments:
            continue
        flags.append(six.text_type(value))
    return flags
def _options_to_args(**options):
    """
    Converts ``options`` into a list of command-line arguments.
    Skip arguments where no value is provided
    For flag-type (No argument) variables, pass only the name and only then if the value is True
    """
    flags = []
    for name in sorted(options):
        value = options[name]
        formatted_flag = '--%s' % name if len(name) > 1 else '-%s' % name
        formatted_flag = formatted_flag.replace('_', '-')
        accepts_no_arguments = formatted_flag in NO_ARGUMENT_OPTIONS
        if value is None or (value is False and accepts_no_arguments):
            continue
        flags.append(formatted_flag)
        if accepts_no_arguments:
            continue
        flags.append(six.text_type(value))
    return flags
def _options_to_args ( * * options ) : flags = [ ] for name in sorted ( options ) : value = options [ name ] formatted_flag = '--%s' % name if len ( name ) > 1 else '-%s' % name formatted_flag = formatted_flag . replace ( '_' , '-' ) accepts_no_arguments = formatted_flag in NO_ARGUMENT_OPTIONS if value is None or ( value is False and accepts_no_arguments ) : continue flags . append ( formatted_flag ) if accepts_no_arguments : continue flags . append ( six . text_type ( value ) ) return flags
Converts ``options`` into a list of command-line arguments.
    Skip arguments where no value is provided
    For flag-type (No argument) variables, pass only the name and only then if the value is True
Converts options into a list of command - line arguments . Skip arguments where no value is provided For flag - type ( No argument ) variables pass only the name and only then if the value is True