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.

NOTE: The README on github contains information and examples complementary to these docs.

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.urepr

3542

ubelt.Path

1915

ubelt.paragraph

866

ubelt.cmd

654

ubelt.ProgIter

600

ubelt.codeblock

567

ubelt.udict

485

ubelt.expandpath

399

ubelt.take

305

ubelt.ddict

241

ubelt.group_items

228

ubelt.flatten

226

ubelt.oset

224

ubelt.dzip

210

ubelt.ensuredir

201

ubelt.odict

189

ubelt.map_vals

186

ubelt.iterable

185

ubelt.peek

184

ubelt.NiceRepr

179

ubelt.NoParam

178

ubelt.hash_data

145

ubelt.Timer

144

ubelt.argflag

143

ubelt.grabdata

135

ubelt.dict_hist

119

ubelt.argval

111

ubelt.color_text

103

ubelt.IndexableWalker

100

ubelt.dict_isect

100

ubelt.augpath

99

ubelt.schedule_deprecation

96

ubelt.allsame

92

ubelt.identity

86

ubelt.named_product

85

ubelt.compress

83

ubelt.JobPool

79

ubelt.memoize

79

ubelt.hzcat

75

ubelt.dict_diff

73

ubelt.delete

67

ubelt.symlink

60

ubelt.dict_union

58

ubelt.unique

57

ubelt.indent

57

ubelt.hash_file

55

ubelt.WIN32

55

ubelt.ensure_app_cache_dir

55

ubelt.timestamp

51

ubelt.invert_dict

49

ubelt.find_exe

47

ubelt.find_duplicates

46

ubelt.iter_window

45

ubelt.highlight_code

43

ubelt.map_keys

42

ubelt.chunks

40

ubelt.import_module_from_name

40

ubelt.modname_to_modpath

36

ubelt.argsort

36

ubelt.dict_subset

35

ubelt.Cacher

34

ubelt.memoize_property

32

ubelt.CacheStamp

29

ubelt.sorted_vals

28

ubelt.argmax

28

ubelt.writeto

28

ubelt.import_module_from_path

28

ubelt.ChDir

23

ubelt.Executor

23

ubelt.compatible

18

ubelt.ensure_unicode

17

ubelt.sorted_keys

17

ubelt.touch

16

ubelt.memoize_method

15

ubelt.readfrom

15

ubelt.timeparse

10

ubelt.AutoDict

10

ubelt.modpath_to_modname

8

ubelt.argmin

8

ubelt.shrinkuser

8

ubelt.boolmask

7

ubelt.zopen

7

ubelt.download

6

ubelt.LINUX

6

ubelt.inject_method

6

ubelt.varied_values

5

ubelt.CaptureStdout

5

ubelt.NO_COLOR

5

ubelt.OrderedSet

4

ubelt.find_path

4

ubelt.DARWIN

4

ubelt.get_app_cache_dir

4

ubelt.UDict

3

ubelt.SetDict

2

ubelt.split_modpath

1

ubelt.map_values

1

ubelt.userhome

1

ubelt.argunique

1

ubelt.unique_flags

1

ubelt.split_archive

0

ubelt.sorted_values

0

ubelt.sdict

0

ubelt.platform_data_dir

0

ubelt.platform_config_dir

0

ubelt.platform_cache_dir

0

ubelt.indexable_allclose

0

ubelt.get_app_data_dir

0

ubelt.get_app_config_dir

0

ubelt.ensure_app_data_dir

0

ubelt.ensure_app_config_dir

0

ubelt.TempDir

0

ubelt.TeeStringIO

0

ubelt.ReprExtensions

0

ubelt.POSIX

0

ubelt.DownloadManager

0

ubelt.CaptureStream

0

ubelt.AutoOrderedDict

0

usage stats = {
    'mean': 129.51282,
    'std': 385.23578,
    'min': 0.0,
    'max': 3542.0,
    'q_0.25': 5.0,
    'q_0.50': 36.0,
    'q_0.75': 100.0,
    'med': 36.0,
    'sum': np.int64(15153),
    'shape': (117,),
}

ubelt.orderedsetΒΆ

<ubelt.OrderedSet> <ubelt.oset>

ubelt.progiterΒΆ

<ubelt.ProgIter>

ubelt.util_argΒΆ

<ubelt.argval> <ubelt.argflag>

ubelt.util_cacheΒΆ

<ubelt.Cacher> <ubelt.CacheStamp>

ubelt.util_cmdΒΆ

<ubelt.cmd>

ubelt.util_colorsΒΆ

<ubelt.NO_COLOR> <ubelt.FORCE_COLOR> <ubelt.highlight_code> <ubelt.color_text>

ubelt.util_constΒΆ

<ubelt.NoParam>

ubelt.util_deprecateΒΆ

<ubelt.schedule_deprecation>

ubelt.util_dictΒΆ

<ubelt.AutoDict> <ubelt.AutoOrderedDict> <ubelt.dzip> <ubelt.ddict> <ubelt.dict_hist> <ubelt.dict_subset> <ubelt.dict_union> <ubelt.dict_isect> <ubelt.dict_diff> <ubelt.find_duplicates> <ubelt.group_items> <ubelt.invert_dict> <ubelt.map_keys> <ubelt.map_vals> <ubelt.map_values> <ubelt.sorted_keys> <ubelt.sorted_vals> <ubelt.sorted_values> <ubelt.odict> <ubelt.named_product> <ubelt.varied_values> <ubelt.SetDict> <ubelt.UDict> <ubelt.sdict> <ubelt.udict>

ubelt.util_downloadΒΆ

<ubelt.download> <ubelt.grabdata>

ubelt.util_download_managerΒΆ

<ubelt.DownloadManager>

ubelt.util_formatΒΆ

<ubelt.repr2> <ubelt.urepr> <ubelt.FormatterExtensions>

ubelt.util_funcΒΆ

<ubelt.identity> <ubelt.inject_method> <ubelt.compatible>

ubelt.util_futuresΒΆ

<ubelt.Executor> <ubelt.JobPool>

ubelt.util_hashΒΆ

<ubelt.hash_data> <ubelt.hash_file>

ubelt.util_importΒΆ

<ubelt.split_modpath> <ubelt.modname_to_modpath> <ubelt.modpath_to_modname> <ubelt.import_module_from_name> <ubelt.import_module_from_path>

ubelt.util_indexableΒΆ

<ubelt.Difference> <ubelt.IndexableWalker> <ubelt.indexable_allclose>

ubelt.util_ioΒΆ

<ubelt.readfrom> <ubelt.writeto> <ubelt.touch> <ubelt.delete>

ubelt.util_listΒΆ

<ubelt.allsame> <ubelt.argmax> <ubelt.argmin> <ubelt.argsort> <ubelt.argunique> <ubelt.boolmask> <ubelt.chunks> <ubelt.compress> <ubelt.flatten> <ubelt.iter_window> <ubelt.iterable> <ubelt.peek> <ubelt.take> <ubelt.unique> <ubelt.unique_flags>

ubelt.util_memoizeΒΆ

<ubelt.memoize> <ubelt.memoize_method> <ubelt.memoize_property>

ubelt.util_mixinsΒΆ

<ubelt.NiceRepr>

ubelt.util_pathΒΆ

<ubelt.Path> <ubelt.TempDir> <ubelt.augpath> <ubelt.shrinkuser> <ubelt.userhome> <ubelt.ensuredir> <ubelt.expandpath> <ubelt.ChDir>

ubelt.util_platformΒΆ

<ubelt.WIN32> <ubelt.LINUX> <ubelt.DARWIN> <ubelt.POSIX> <ubelt.find_exe> <ubelt.find_path> <ubelt.ensure_app_cache_dir> <ubelt.ensure_app_config_dir> <ubelt.ensure_app_data_dir> <ubelt.get_app_cache_dir> <ubelt.get_app_config_dir> <ubelt.get_app_data_dir> <ubelt.platform_cache_dir> <ubelt.platform_config_dir> <ubelt.platform_data_dir>

ubelt.util_reprΒΆ

<ubelt.urepr> <ubelt.ReprExtensions>

ubelt.util_strΒΆ

<ubelt.indent> <ubelt.codeblock> <ubelt.paragraph> <ubelt.hzcat> <ubelt.ensure_unicode>

ubelt.util_streamΒΆ

<ubelt.TeeStringIO> <ubelt.CaptureStdout> <ubelt.CaptureStream>

ubelt.util_timeΒΆ

<ubelt.timestamp> <ubelt.timeparse> <ubelt.Timer>

ubelt.util_zipΒΆ

<ubelt.zopen> <ubelt.split_archive>

Package Layout

Indices and tablesΒΆ