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.

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

3648

ubelt.Path

2023

ubelt.paragraph

911

ubelt.cmd

659

ubelt.ProgIter

621

ubelt.codeblock

588

ubelt.udict

496

ubelt.expandpath

406

ubelt.take

312

ubelt.ddict

255

ubelt.oset

239

ubelt.flatten

235

ubelt.group_items

234

ubelt.dzip

214

ubelt.ensuredir

207

ubelt.odict

189

ubelt.map_vals

188

ubelt.iterable

186

ubelt.peek

186

ubelt.NiceRepr

179

ubelt.NoParam

174

ubelt.Timer

152

ubelt.hash_data

150

ubelt.argflag

144

ubelt.grabdata

142

ubelt.dict_hist

123

ubelt.argval

110

ubelt.color_text

103

ubelt.dict_isect

102

ubelt.IndexableWalker

99

ubelt.augpath

99

ubelt.schedule_deprecation

98

ubelt.allsame

94

ubelt.JobPool

85

ubelt.named_product

85

ubelt.compress

83

ubelt.memoize

81

ubelt.hzcat

79

ubelt.dict_diff

78

ubelt.identity

76

ubelt.delete

70

ubelt.symlink

61

ubelt.dict_union

58

ubelt.unique

57

ubelt.indent

57

ubelt.hash_file

55

ubelt.WIN32

55

ubelt.ensure_app_cache_dir

55

ubelt.invert_dict

52

ubelt.timestamp

51

ubelt.find_exe

48

ubelt.find_duplicates

48

ubelt.iter_window

46

ubelt.highlight_code

45

ubelt.map_keys

42

ubelt.chunks

41

ubelt.import_module_from_name

40

ubelt.argsort

38

ubelt.modname_to_modpath

36

ubelt.dict_subset

36

ubelt.Cacher

36

ubelt.memoize_property

32

ubelt.CacheStamp

31

ubelt.argmax

30

ubelt.ChDir

29

ubelt.sorted_vals

28

ubelt.writeto

28

ubelt.import_module_from_path

28

ubelt.Executor

22

ubelt.sorted_keys

19

ubelt.compatible

18

ubelt.CaptureStdout

17

ubelt.touch

16

ubelt.memoize_method

15

ubelt.readfrom

15

ubelt.ensure_unicode

13

ubelt.timeparse

10

ubelt.AutoDict

10

ubelt.modpath_to_modname

8

ubelt.argmin

8

ubelt.shrinkuser

8

ubelt.boolmask

7

ubelt.zopen

7

ubelt.varied_values

7

ubelt.download

6

ubelt.LINUX

6

ubelt.inject_method

6

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ΒΆ