Version 1.1.0 - Unreleased
Added
- New method:
ub.timeparse
can parse the result ofub.timestamp
into a
datetime
object. Can optionally usedateutil.parser.parse
under the hood. ub.Path.ls
a convenience function that aliaseslist(path.iterdir())
.ub.Path.walk
to wrapos.walk
.
Changed
- Register
pathlib.Path
withub.repr2
- Can now register global
ub.repr2
extensionsub.repr2.register
- Can now register global
ub.hash_data
extensionsub.hash_data..register
- Removed deprecated arguments from
ubelt.cmd
. ub.CacheStamp
will now check the mtime and size to quickly check if the products
have changed and force expiration.ub.CacheStamp
now takes anexpires
keyword arg, which will keep the cache valid
only for the specified amount of time.ub.CacheStamp
now takes anhash_prefix
keyword arg, which will check that it
matches the hash of the product.ub.cmd
now has asystem
argument for modularity withos.system
.ub.cmd
now accepts atimeout
argument (tee support is pending).ub.JobPool
now contains a protected_prog
variable allowing the user
finer-grained progress controls.ub.JobPool
now contains a convenience methodjoin
that executes all jobs
and returns a list of results.ub.timestamp
can now accept adatetime
object as an argument, and will return
the timestamp for that object.- The
ubelt.util_download.grabdata
function now usesCacheStamp
instead of
implementing its own stamp solution. - The
ubelt.util_hash.HashableExtensions
implementation was updated to use
functools.singledispatch
instead of the custom solution. This seems faster
and should not have any API impact.
Deprecated
product
andcfgstr
arguments toCacheStamp.expired
product
andcfgstr
arguments toCacheStamp.renew
- Passing
hasher
as an instance to functions likegrabdata
orCacheStamp
can cause unexpected hashes as they may be used more than once.
Fixed
ub.hash_data
now recognizes subclasses of registered types.ub.timestamp()
has been outputting incorrect (negated) UTC offsets. This is now fixed.ub.timestamp()
now works correctly when the year has less than 4 digits.