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

2893

ubelt.Path

992

ubelt.ProgIter

544

ubelt.paragraph

482

ubelt.take

387

ubelt.codeblock

358

ubelt.expandpath

331

ubelt.cmd

302

ubelt.udict

271

ubelt.ensuredir

256

ubelt.odict

253

ubelt.iterable

252

ubelt.ddict

238

ubelt.NiceRepr

221

ubelt.NoParam

216

ubelt.map_vals

215

ubelt.flatten

214

ubelt.dzip

200

ubelt.oset

198

ubelt.peek

196

ubelt.argflag

177

ubelt.group_items

171

ubelt.hash_data

165

ubelt.grabdata

131

ubelt.argval

125

ubelt.Timer

120

ubelt.dict_isect

113

ubelt.dict_hist

111

ubelt.augpath

106

ubelt.identity

106

ubelt.ensure_app_cache_dir

105

ubelt.allsame

102

ubelt.memoize

99

ubelt.color_text

98

ubelt.dict_diff

95

ubelt.delete

89

ubelt.hzcat

88

ubelt.schedule_deprecation

87

ubelt.named_product

85

ubelt.compress

85

ubelt.IndexableWalker

74

ubelt.indent

68

ubelt.JobPool

67

ubelt.unique

63

ubelt.dict_union

57

ubelt.map_keys

49

ubelt.invert_dict

48

ubelt.iter_window

46

ubelt.timestamp

46

ubelt.argsort

44

ubelt.Cacher

43

ubelt.find_exe

41

ubelt.symlink

41

ubelt.dict_subset

41

ubelt.writeto

40

ubelt.find_duplicates

39

ubelt.chunks

38

ubelt.hash_file

37

ubelt.modname_to_modpath

37

ubelt.ensure_unicode

33

ubelt.memoize_property

33

ubelt.highlight_code

33

ubelt.sorted_vals

32

ubelt.CacheStamp

30

ubelt.WIN32

28

ubelt.import_module_from_name

27

ubelt.argmax

27

ubelt.readfrom

23

ubelt.import_module_from_path

22

ubelt.compatible

17

ubelt.touch

17

ubelt.Executor

16

ubelt.memoize_method

16

ubelt.sorted_keys

14

ubelt.AutoDict

11

ubelt.shrinkuser

11

ubelt.inject_method

10

ubelt.varied_values

9

ubelt.split_modpath

8

ubelt.modpath_to_modname

8

ubelt.get_app_cache_dir

8

ubelt.zopen

7

ubelt.LINUX

7

ubelt.CaptureStdout

6

ubelt.download

5

ubelt.timeparse

5

ubelt.DARWIN

5

ubelt.argmin

5

ubelt.find_path

4

ubelt.indexable_allclose

4

ubelt.boolmask

3

ubelt.map_values

2

ubelt.AutoOrderedDict

2

ubelt.argunique

2

ubelt.NO_COLOR

2

ubelt.UDict

1

ubelt.unique_flags

1

ubelt.userhome

0

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

0

ubelt.ReprExtensions

0

ubelt.POSIX

0

ubelt.OrderedSet

0

ubelt.DownloadManager

0

ubelt.CaptureStream

0

usage stats = {
    'mean': 109.39655,
    'std': 292.5527,
    'min': 0.0,
    'max': 2893.0,
    'q_0.25': 5.0,
    'q_0.50': 37.0,
    'q_0.75': 106.0,
    'med': 37.0,
    'sum': 12690,
    'shape': (116,),
}

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