![]() ![]() Group a sequence of items by some criterion (group_items) Get a histogram of items or find duplicates in a list (dict_hist, find_duplicates) Memoize functions (memoize, memoize_method, memoize_property)Īrgmax/min/sort on lists and dictionaries (argmin, argsort,) Import a module using the path to that module (import_module_from_path)Ĭheck if a particular flag or value is on the command line (argflag, argval) Horizontally concatenate multiline strings (hzcat) String-format nested data structures (urepr) Show loop progress with less overhead than tqdm (ProgIter)ĭownload a file with optional caching and hash verification (download, grabdata)įind a file or directory in candidate locations (find_path, find_exe) (hash_data)Ĭache a block of code (Cacher, CacheStamp) Hash common data structures like list, dict, int, str, etc. Perform set operations on dictionaries (SetDict)Ī dictionary with extended helper methods like subdict, take, peek_value, invert, sorted_keys, sorted_vals (UDict) Get paths to cross platform data/cache/config directories (ub.Path.appdir, …) ![]() These are some of the tasks that ubelt’s API enables:Įxtended pathlib with expand, ensuredir, endswith, augment, delete (ub.Path) Method: All functions are written with docstrings and doctests to ensure that a baseline level of documentation and testing always exists (even if functions are copy/pasted into other libraries) Goal: provide simple functions that accomplish common tasks not yet addressed by the python standard library.Ĭonstraints: Must be low-impact pure python it should be easy to install and use. This provides helpful documentation and example usage as well as helpingĪchieve 100% test coverage (with minor exceptions on Windows). Almost every function in ubelt was written with a doctest. Similarly on Windows, Mac, and Linux (up to some small unavoidableĭifferences). Ubelt is a small library of robust, tested, documented, and simple functions ![]()
0 Comments
Leave a Reply. |