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 |
|---|---|
4327 |
|
2125 |
|
1349 |
|
747 |
|
657 |
|
611 |
|
603 |
|
508 |
|
462 |
|
342 |
|
341 |
|
313 |
|
303 |
|
287 |
|
270 |
|
267 |
|
265 |
|
262 |
|
|
248 |
239 |
|
236 |
|
200 |
|
184 |
|
161 |
|
156 |
|
156 |
|
152 |
|
145 |
|
142 |
|
134 |
|
133 |
|
129 |
|
123 |
|
120 |
|
117 |
|
116 |
|
116 |
|
107 |
|
104 |
|
90 |
|
88 |
|
84 |
|
|
78 |
76 |
|
76 |
|
69 |
|
67 |
|
62 |
|
58 |
|
57 |
|
56 |
|
55 |
|
54 |
|
53 |
|
53 |
|
51 |
|
50 |
|
50 |
|
50 |
|
49 |
|
47 |
|
40 |
|
38 |
|
37 |
|
36 |
|
36 |
|
32 |
|
30 |
|
29 |
|
24 |
|
24 |
|
23 |
|
23 |
|
17 |
|
17 |
|
17 |
|
14 |
|
13 |
|
11 |
|
11 |
|
10 |
|
9 |
|
8 |
|
|
8 |
7 |
|
|
7 |
6 |
|
6 |
|
6 |
|
|
5 |
4 |
|
4 |
|
4 |
|
3 |
|
3 |
|
2 |
|
2 |
|
2 |
|
1 |
|
1 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
|
0 |
0 |
|
0 |
usage stats = {
'mean': 164.10257,
'std': 467.12064,
'min': 0.0,
'max': 4327.0,
'q_0.25': 6.0,
'q_0.50': 50.0,
'q_0.75': 134.0,
'med': 50.0,
'sum': 19200,
'shape': (117,),
}
ubelt.orderedsetΒΆ
ubelt.progiterΒΆ
ubelt.util_argΒΆ
ubelt.util_cacheΒΆ
ubelt.util_cmdΒΆ
ubelt.util_colorsΒΆ
<ubelt.NO_COLOR>
<ubelt.highlight_code>
<ubelt.color_text>
ubelt.util_constΒΆ
<ubelt.NoParam>
ubelt.util_deprecateΒΆ
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.util_download_managerΒΆ
ubelt.util_formatΒΆ
ubelt.util_funcΒΆ
ubelt.util_futuresΒΆ
ubelt.util_hashΒΆ
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.util_ioΒΆ
<ubelt.readfrom>
<ubelt.writeto>
<ubelt.touch>
<ubelt.delete>
ubelt.util_linksΒΆ
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.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.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.util_zipΒΆ
<ubelt.zopen>
<ubelt.split_archive>
Package Layout
- ubelt package
- Submodules
- ubelt.__main__ module
- ubelt._win32_links module
- ubelt.orderedset module
OrderedSetOrderedSet.copy()OrderedSet.add()OrderedSet.append()OrderedSet.update()OrderedSet.index()OrderedSet.get_loc()OrderedSet.get_indexer()OrderedSet.pop()OrderedSet.discard()OrderedSet.clear()OrderedSet.union()OrderedSet.intersection()OrderedSet.difference()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.symmetric_difference()OrderedSet._update_items()OrderedSet.difference_update()OrderedSet.intersection_update()OrderedSet.symmetric_difference_update()OrderedSet._abc_impl
oset
- ubelt.progiter module
ProgIterProgIter.set_extra()ProgIter._reset_internals()ProgIter.begin()ProgIter.end()ProgIter._iterate()ProgIter._homogeneous_check()ProgIter._slow_path_step_body()ProgIter.step()ProgIter._adjust_frequency()ProgIter._measure_time()ProgIter._update_message_template()ProgIter._build_message_template()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.ensure_newline()ProgIter.display_message()ProgIter._tryflush()ProgIter._write()
- ubelt.util_arg module
- ubelt.util_cache module
CacherCacheStampCacheStamp.fpathCacheStamp.clear()CacheStamp._get_certificate()CacheStamp._rectify_products()CacheStamp._rectify_hash_prefixes()CacheStamp._product_info()CacheStamp._product_file_stats()CacheStamp._product_file_hash()CacheStamp.expired()CacheStamp._check_certificate_hashes()CacheStamp._expires()CacheStamp._new_certificate()CacheStamp.renew()
_localnow()_byte_str()
- ubelt.util_cmd module
- ubelt.util_colors module
- ubelt.util_const module
- ubelt.util_deprecate module
- ubelt.util_dict module
- ubelt.util_download module
- ubelt.util_download_manager module
- ubelt.util_format module
- ubelt.util_func module
- ubelt.util_futures module
- ubelt.util_hash module
- ubelt.util_import module
- ubelt.util_indexable module
- ubelt.util_io module
- ubelt.util_links module
- ubelt.util_list module
- ubelt.util_memoize module
- ubelt.util_mixins module
- ubelt.util_path module
- ubelt.util_platform module
- ubelt.util_repr module
- ubelt.util_str module
- ubelt.util_stream module
- ubelt.util_time module
- ubelt.util_zip module
- Module contents
AutoDictAutoOrderedDictCacheStampCacheStamp.fpathCacheStamp.clear()CacheStamp._get_certificate()CacheStamp._rectify_products()CacheStamp._rectify_hash_prefixes()CacheStamp._product_info()CacheStamp._product_file_stats()CacheStamp._product_file_hash()CacheStamp.expired()CacheStamp._check_certificate_hashes()CacheStamp._expires()CacheStamp._new_certificate()CacheStamp.renew()
CacherCaptureStdoutCaptureStreamChDirDownloadManagerExecutorFormatterExtensionsIndexableWalkerJobPoolNiceReprOrderedSetOrderedSet.copy()OrderedSet.add()OrderedSet.append()OrderedSet.update()OrderedSet.index()OrderedSet.get_loc()OrderedSet.get_indexer()OrderedSet.pop()OrderedSet.discard()OrderedSet.clear()OrderedSet.union()OrderedSet.intersection()OrderedSet.difference()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.symmetric_difference()OrderedSet._update_items()OrderedSet.difference_update()OrderedSet.intersection_update()OrderedSet.symmetric_difference_update()OrderedSet._abc_impl
PathProgIterProgIter.set_extra()ProgIter._reset_internals()ProgIter.begin()ProgIter.end()ProgIter._iterate()ProgIter._homogeneous_check()ProgIter._slow_path_step_body()ProgIter.step()ProgIter._adjust_frequency()ProgIter._measure_time()ProgIter._update_message_template()ProgIter._build_message_template()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.ensure_newline()ProgIter.display_message()ProgIter._tryflush()ProgIter._write()
ReprExtensionsSetDictTeeStringIOTempDirTimerUDictallsame()argflag()argmax()argmin()argsort()argunique()argval()augpath()boolmask()chunkscmd()codeblock()color_text()compatible()compress()ddictdelete()dict_diff()dict_hist()dict_isect()dict_subset()dict_union()download()dzip()ensure_app_cache_dir()ensure_app_config_dir()ensure_app_data_dir()ensure_unicode()ensuredir()expandpath()find_duplicates()find_exe()find_path()flatten()get_app_cache_dir()get_app_config_dir()get_app_data_dir()grabdata()group_items()hash_data()hash_file()highlight_code()hzcat()identity()import_module_from_name()import_module_from_path()indent()indexable_allclose()inject_method()invert_dict()iter_window()iterable()map_keys()map_vals()map_values()memoize()memoize_methodmemoize_property()modname_to_modpath()modpath_to_modname()named_product()odictosetparagraph()peek()platform_cache_dir()platform_config_dir()platform_data_dir()readfrom()repr2()schedule_deprecation()sdictshrinkuser()sorted_keys()sorted_vals()sorted_values()split_archive()split_modpath()symlink()take()timeparse()timestamp()touch()udictunique()unique_flags()urepr()userhome()varied_values()writeto()zopen
- Submodules
- ubelt
- ubelt package
- Submodules
- ubelt.__main__ module
- ubelt._win32_links module
- ubelt.orderedset module
OrderedSetOrderedSet.copy()OrderedSet.add()OrderedSet.append()OrderedSet.update()OrderedSet.index()OrderedSet.get_loc()OrderedSet.get_indexer()OrderedSet.pop()OrderedSet.discard()OrderedSet.clear()OrderedSet.union()OrderedSet.intersection()OrderedSet.difference()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.symmetric_difference()OrderedSet._update_items()OrderedSet.difference_update()OrderedSet.intersection_update()OrderedSet.symmetric_difference_update()OrderedSet._abc_impl
oset
- ubelt.progiter module
ProgIterProgIter.set_extra()ProgIter._reset_internals()ProgIter.begin()ProgIter.end()ProgIter._iterate()ProgIter._homogeneous_check()ProgIter._slow_path_step_body()ProgIter.step()ProgIter._adjust_frequency()ProgIter._measure_time()ProgIter._update_message_template()ProgIter._build_message_template()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.ensure_newline()ProgIter.display_message()ProgIter._tryflush()ProgIter._write()
- ubelt.util_arg module
- ubelt.util_cache module
CacherCacheStampCacheStamp.fpathCacheStamp.clear()CacheStamp._get_certificate()CacheStamp._rectify_products()CacheStamp._rectify_hash_prefixes()CacheStamp._product_info()CacheStamp._product_file_stats()CacheStamp._product_file_hash()CacheStamp.expired()CacheStamp._check_certificate_hashes()CacheStamp._expires()CacheStamp._new_certificate()CacheStamp.renew()
_localnow()_byte_str()
- ubelt.util_cmd module
- ubelt.util_colors module
- ubelt.util_const module
- ubelt.util_deprecate module
- ubelt.util_dict module
- ubelt.util_download module
- ubelt.util_download_manager module
- ubelt.util_format module
- ubelt.util_func module
- ubelt.util_futures module
- ubelt.util_hash module
- ubelt.util_import module
- ubelt.util_indexable module
- ubelt.util_io module
- ubelt.util_links module
- ubelt.util_list module
- ubelt.util_memoize module
- ubelt.util_mixins module
- ubelt.util_path module
- ubelt.util_platform module
- ubelt.util_repr module
- ubelt.util_str module
- ubelt.util_stream module
- ubelt.util_time module
- ubelt.util_zip module
- Module contents
AutoDictAutoOrderedDictCacheStampCacheStamp.fpathCacheStamp.clear()CacheStamp._get_certificate()CacheStamp._rectify_products()CacheStamp._rectify_hash_prefixes()CacheStamp._product_info()CacheStamp._product_file_stats()CacheStamp._product_file_hash()CacheStamp.expired()CacheStamp._check_certificate_hashes()CacheStamp._expires()CacheStamp._new_certificate()CacheStamp.renew()
CacherCaptureStdoutCaptureStreamChDirDownloadManagerExecutorFormatterExtensionsIndexableWalkerJobPoolNiceReprOrderedSetOrderedSet.copy()OrderedSet.add()OrderedSet.append()OrderedSet.update()OrderedSet.index()OrderedSet.get_loc()OrderedSet.get_indexer()OrderedSet.pop()OrderedSet.discard()OrderedSet.clear()OrderedSet.union()OrderedSet.intersection()OrderedSet.difference()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.symmetric_difference()OrderedSet._update_items()OrderedSet.difference_update()OrderedSet.intersection_update()OrderedSet.symmetric_difference_update()OrderedSet._abc_impl
PathProgIterProgIter.set_extra()ProgIter._reset_internals()ProgIter.begin()ProgIter.end()ProgIter._iterate()ProgIter._homogeneous_check()ProgIter._slow_path_step_body()ProgIter.step()ProgIter._adjust_frequency()ProgIter._measure_time()ProgIter._update_message_template()ProgIter._build_message_template()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.ensure_newline()ProgIter.display_message()ProgIter._tryflush()ProgIter._write()
ReprExtensionsSetDictTeeStringIOTempDirTimerUDictallsame()argflag()argmax()argmin()argsort()argunique()argval()augpath()boolmask()chunkscmd()codeblock()color_text()compatible()compress()ddictdelete()dict_diff()dict_hist()dict_isect()dict_subset()dict_union()download()dzip()ensure_app_cache_dir()ensure_app_config_dir()ensure_app_data_dir()ensure_unicode()ensuredir()expandpath()find_duplicates()find_exe()find_path()flatten()get_app_cache_dir()get_app_config_dir()get_app_data_dir()grabdata()group_items()hash_data()hash_file()highlight_code()hzcat()identity()import_module_from_name()import_module_from_path()indent()indexable_allclose()inject_method()invert_dict()iter_window()iterable()map_keys()map_vals()map_values()memoize()memoize_methodmemoize_property()modname_to_modpath()modpath_to_modname()named_product()odictosetparagraph()peek()platform_cache_dir()platform_config_dir()platform_data_dir()readfrom()repr2()schedule_deprecation()sdictshrinkuser()sorted_keys()sorted_vals()sorted_values()split_archive()split_modpath()symlink()take()timeparse()timestamp()touch()udictunique()unique_flags()urepr()userhome()varied_values()writeto()zopen
- Submodules
- ubelt package