rez.util

Misc useful stuff. TODO: Move this into rez.utils.?

class rez.util.ProgressBar

Bases: Bar

__init__(label, max)
file = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
hide_cursor = True
bar_prefix = ' |'
bar_suffix = '| '
check_tty = True
clearln()
property elapsed
property elapsed_td
empty_fill = ' '
property eta
property eta_td
fill = '#'
finish()
goto(index)
is_tty()
iter(it)
next(n=1)
property percent
property progress
property remaining
sma_window = 10
start()
suffix = '%(index)d/%(max)d'
update()
update_avg(n, dt)
width = 32
write(s)
writeln(line)
rez.util.dedup(seq)

Remove duplicates from a list while keeping order.

rez.util.shlex_join(value, unsafe_regex=None, replacements=None, enclose_with='"')

Join args into a valid shell command.

rez.util.which(*programs, **shutilwhich_kwargs)
rez.util.get_close_matches(term, fields, fuzziness=0.4, key=None)
rez.util.get_close_pkgs(pkg, pkgs, fuzziness=0.4)
rez.util.find_last_sublist(list_, sublist)

Given a list, find the last occurance of a sublist within it.

Returns:

Index where the sublist starts, or None if there is no match.

rez.util.is_non_string_iterable(arg)

Python 2 and 3 compatible non-string iterable identifier

rez.util.get_function_arg_names(func)

Get names of a function’s args.

Gives full list of positional and keyword-only args.

rez.util.load_module_from_file(name, filepath)

Load a python module from a sourcefile.

Parameters:
  • name (str) – Module name.

  • filepath (str) – Python sourcefile.

Returns:

Loaded module.

Return type:

module