示例#1
0
def format_flag(val, truncate_floats=False, shorten_paths=False):
    fmt_val = encode_flag_val(val)
    if truncate_floats and isinstance(val, float):
        trunc_len = _trunc_len(truncate_floats)
        fmt_val = _truncate_formatted_float(fmt_val, trunc_len)
    if shorten_paths and _is_path(val):
        path_len = _path_len(shorten_paths)
        fmt_val = util.shorten_path(val, path_len)
    return _quote_encoded(fmt_val, val)
示例#2
0
def shorten_op_dir(op_dir, cwd):
    return util.shorten_path(_format_op_dir(op_dir, cwd))