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 |
|---|---|
3542 |
|
1915 |
|
866 |
|
654 |
|
600 |
|
567 |
|
485 |
|
399 |
|
305 |
|
241 |
|
228 |
|
226 |
|
224 |
|
210 |
|
201 |
|
189 |
|
186 |
|
185 |
|
184 |
|
179 |
|
|
178 |
145 |
|
144 |
|
143 |
|
135 |
|
119 |
|
111 |
|
103 |
|
100 |
|
100 |
|
99 |
|
96 |
|
92 |
|
86 |
|
85 |
|
83 |
|
79 |
|
79 |
|
75 |
|
73 |
|
67 |
|
60 |
|
58 |
|
57 |
|
57 |
|
55 |
|
|
55 |
55 |
|
51 |
|
49 |
|
47 |
|
46 |
|
45 |
|
43 |
|
42 |
|
40 |
|
40 |
|
36 |
|
36 |
|
35 |
|
34 |
|
32 |
|
29 |
|
28 |
|
28 |
|
28 |
|
28 |
|
23 |
|
23 |
|
18 |
|
17 |
|
17 |
|
16 |
|
15 |
|
15 |
|
10 |
|
10 |
|
8 |
|
8 |
|
8 |
|
7 |
|
7 |
|
6 |
|
|
6 |
6 |
|
5 |
|
5 |
|
|
5 |
4 |
|
4 |
|
|
4 |
4 |
|
3 |
|
2 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
0 |
|
|
0 |
0 |
|
0 |
|
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.progiterΒΆ
ubelt.util_argΒΆ
ubelt.util_cacheΒΆ
ubelt.util_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.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.Difference>
<ubelt.IndexableWalker>
<ubelt.indexable_allclose>
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.__call__()ProgIter.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
CacherCacher.VERBOSECacher.FORCE_DISABLECacher._rectify_cfgstr()Cacher._condense_cfgstr()Cacher.fpathCacher.get_fpath()Cacher.exists()Cacher.existing_versions()Cacher.clear()Cacher.tryload()Cacher.load()Cacher.save()Cacher._backend_load()Cacher._backend_dump()Cacher.ensure()Cacher.__call__()
CacheStampCacheStamp.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._check_certificate_hashes()CacheStamp._expires()CacheStamp._get_certificate()CacheStamp._new_certificate()CacheStamp._product_file_hash()CacheStamp._product_file_stats()CacheStamp._product_info()CacheStamp._rectify_hash_prefixes()CacheStamp._rectify_products()CacheStamp.clear()CacheStamp.expired()CacheStamp.fpathCacheStamp.renew()
CacherCacher.FORCE_DISABLECacher.VERBOSECacher.__call__()Cacher._backend_dump()Cacher._backend_load()Cacher._condense_cfgstr()Cacher._rectify_cfgstr()Cacher.clear()Cacher.ensure()Cacher.existing_versions()Cacher.exists()Cacher.fpathCacher.get_fpath()Cacher.load()Cacher.save()Cacher.tryload()
CaptureStdoutCaptureStreamChDirDownloadManagerExecutorFormatterExtensionsIndexableWalkerJobPoolNiceReprOrderedSetOrderedSet._abc_implOrderedSet._update_items()OrderedSet.add()OrderedSet.append()OrderedSet.clear()OrderedSet.copy()OrderedSet.difference()OrderedSet.difference_update()OrderedSet.discard()OrderedSet.get_indexer()OrderedSet.get_loc()OrderedSet.index()OrderedSet.intersection()OrderedSet.intersection_update()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.pop()OrderedSet.symmetric_difference()OrderedSet.symmetric_difference_update()OrderedSet.union()OrderedSet.update()
PathProgIterProgIter.__call__()ProgIter._adjust_frequency()ProgIter._build_message_template()ProgIter._homogeneous_check()ProgIter._iterate()ProgIter._measure_time()ProgIter._reset_internals()ProgIter._slow_path_step_body()ProgIter._tryflush()ProgIter._update_message_template()ProgIter._write()ProgIter.begin()ProgIter.display_message()ProgIter.end()ProgIter.ensure_newline()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.set_extra()ProgIter.step()
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.__call__()ProgIter.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
CacherCacher.VERBOSECacher.FORCE_DISABLECacher._rectify_cfgstr()Cacher._condense_cfgstr()Cacher.fpathCacher.get_fpath()Cacher.exists()Cacher.existing_versions()Cacher.clear()Cacher.tryload()Cacher.load()Cacher.save()Cacher._backend_load()Cacher._backend_dump()Cacher.ensure()Cacher.__call__()
CacheStampCacheStamp.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._check_certificate_hashes()CacheStamp._expires()CacheStamp._get_certificate()CacheStamp._new_certificate()CacheStamp._product_file_hash()CacheStamp._product_file_stats()CacheStamp._product_info()CacheStamp._rectify_hash_prefixes()CacheStamp._rectify_products()CacheStamp.clear()CacheStamp.expired()CacheStamp.fpathCacheStamp.renew()
CacherCacher.FORCE_DISABLECacher.VERBOSECacher.__call__()Cacher._backend_dump()Cacher._backend_load()Cacher._condense_cfgstr()Cacher._rectify_cfgstr()Cacher.clear()Cacher.ensure()Cacher.existing_versions()Cacher.exists()Cacher.fpathCacher.get_fpath()Cacher.load()Cacher.save()Cacher.tryload()
CaptureStdoutCaptureStreamChDirDownloadManagerExecutorFormatterExtensionsIndexableWalkerJobPoolNiceReprOrderedSetOrderedSet._abc_implOrderedSet._update_items()OrderedSet.add()OrderedSet.append()OrderedSet.clear()OrderedSet.copy()OrderedSet.difference()OrderedSet.difference_update()OrderedSet.discard()OrderedSet.get_indexer()OrderedSet.get_loc()OrderedSet.index()OrderedSet.intersection()OrderedSet.intersection_update()OrderedSet.issubset()OrderedSet.issuperset()OrderedSet.pop()OrderedSet.symmetric_difference()OrderedSet.symmetric_difference_update()OrderedSet.union()OrderedSet.update()
PathProgIterProgIter.__call__()ProgIter._adjust_frequency()ProgIter._build_message_template()ProgIter._homogeneous_check()ProgIter._iterate()ProgIter._measure_time()ProgIter._reset_internals()ProgIter._slow_path_step_body()ProgIter._tryflush()ProgIter._update_message_template()ProgIter._write()ProgIter.begin()ProgIter.display_message()ProgIter.end()ProgIter.ensure_newline()ProgIter.format_message()ProgIter.format_message_parts()ProgIter.set_extra()ProgIter.step()
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