https://i.imgur.com/PoYIsWE.png

UBelt documentation

UBelt is a “utility belt” of commonly needed utility and helper functions. It is a currated collection of top-level utilities with functionality that falls into a mixture of categories.

The source code is available at https://github.com/Erotemic/ubelt. We also have Jupyter notebook demos.

The ubelt API is organized by submodules containing related functionality. Each submodule contains top level overview documentation, and each function contains a docstring with at least one example.

The API by usefulness

Perhaps the most useful way to learn this API is to sort by “usefulness”. I measure usefulness as the number of times I’ve used a particular function in my own code (excluding ubelt itself).

Function name

Usefulness

ubelt.repr2()

2140

ubelt.ProgIter()

715

ubelt.expandpath()

695

ubelt.ensuredir()

553

ubelt.take()

430

ubelt.odict()

391

ubelt.map_vals()

331

ubelt.dzip()

278

ubelt.NiceRepr()

261

ubelt.ddict()

255

ubelt.augpath()

229

ubelt.argflag()

209

ubelt.flatten()

202

ubelt.argval()

200

ubelt.cmd()

199

ubelt.peek()

196

ubelt.NoParam()

189

ubelt.Timerit()

187

ubelt.dict_hist()

173

ubelt.codeblock()

172

ubelt.group_items()

168

ubelt.iterable()

168

ubelt.hash_data()

142

ubelt.grabdata()

127

ubelt.color_text()

97

ubelt.delete()

94

ubelt.dict_subset()

89

ubelt.oset()

88

ubelt.compress()

87

ubelt.allsame()

86

ubelt.Cacher()

81

ubelt.Timer()

70

ubelt.dict_isect()

68

ubelt.indent()

60

ubelt.argsort()

59

ubelt.chunks()

48

ubelt.map_keys()

48

ubelt.invert_dict()

47

ubelt.dict_union()

47

ubelt.memoize()

46

ubelt.timestamp()

46

ubelt.find_duplicates()

45

ubelt.unique()

43

ubelt.import_module_from_path()

40

ubelt.sorted_vals()

39

ubelt.dict_diff()

38

ubelt.hzcat()

38

ubelt.argmax()

37

ubelt.memoize_property()

37

ubelt.writeto()

37

ubelt.iter_window()

35

ubelt.readfrom()

34

ubelt.paragraph()

33

ubelt.identity()

33

ubelt.symlink()

32

ubelt.memoize_method()

31

ubelt.ensure_unicode()

24

ubelt.touch()

24

ubelt.hash_file()

24

ubelt.CacheStamp()

20

ubelt.modname_to_modpath()

17

ubelt.highlight_code()

17

ubelt.import_module_from_name()

16

ubelt.find_exe()

14

ubelt.inject_method()

13

ubelt.shrinkuser()

11

ubelt.AutoDict()

9

ubelt.argmin()

9

ubelt.find_path()

7

ubelt.download()

5

ubelt.sorted_keys()

5

ubelt.CaptureStdout()

4

ubelt.split_modpath()

4

ubelt.modpath_to_modname()

4

ubelt.orderedset()

4

ubelt.userhome()

3

ubelt.argunique()

3

ubelt.AutoOrderedDict()

2

ubelt.unique_flags()

2

ubelt.boolmask()

1

usage stats = {
    'mean': 73.12658,
    'std': 170.95476,
    'min': 1.0,
    'max': 1478.0,
    'med': 27.0,
    'sum': 5777,
    'shape': (79,),
}

ubelt.util_arg

ubelt.PY2() ubelt.string_types() ubelt.argval() ubelt.argflag()

ubelt.util_const

ubelt.NoParam()

ubelt.util_format

ubelt.PY2() ubelt.iteritems() ubelt.string_types() ubelt.text_type() ubelt.repr2() ubelt.FormatterExtensions()

Indices and tables