github Erotemic/ubelt v1.1.0
Version 1.1.0

latest releases: v1.3.6, v1.3.5, v1.3.4...
2 years ago

Version 1.1.0 - Unreleased

Added

  • New method: ub.timeparse can parse the result of ub.timestamp into a
    datetime object. Can optionally use dateutil.parser.parse under the hood.
  • ub.Path.ls a convenience function that aliases list(path.iterdir()).
  • ub.Path.walk to wrap os.walk.

Changed

  • Register pathlib.Path with ub.repr2
  • Can now register global ub.repr2 extensions ub.repr2.register
  • Can now register global ub.hash_data extensions ub.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 an expires keyword arg, which will keep the cache valid
    only for the specified amount of time.
  • ub.CacheStamp now takes an hash_prefix keyword arg, which will check that it
    matches the hash of the product.
  • ub.cmd now has a system argument for modularity with os.system.
  • ub.cmd now accepts a timeout 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 method join that executes all jobs
    and returns a list of results.
  • ub.timestamp can now accept a datetime object as an argument, and will return
    the timestamp for that object.
  • The ubelt.util_download.grabdata function now uses CacheStamp 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 and cfgstr arguments to CacheStamp.expired
  • product and cfgstr arguments to CacheStamp.renew
  • Passing hasher as an instance to functions like grabdata or CacheStamp
    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.

Don't miss a new ubelt release

NewReleases is sending notifications on new releases.