jgdv.mixins.human_numbers

Classes

HumanNumbers_m

Simple Mixin for human related functions

Module Contents

class jgdv.mixins.human_numbers.HumanNumbers_m[source]

Simple Mixin for human related functions

static humanize(val, *, force_sign=True) <Unknown>[source]

Format {val} in a human readable way as a size. Uses tracemalloc._format_size. Depending on size, will use on of the units: B, KiB, MiB, GiB, TiB.

Parameters:
Return type:

str

static round_time(dt=None, *, round=60) <Unknown>[source]

Round a datetime object to any time lapse in seconds dt : datetime.datetime object, default now. round : Closest number of seconds to round to, default 1 minute. Author: Thierry Husson 2012 - Use it as you want but don’t blame me. from: https://stackoverflow.com/questions/3463930

Parameters:
  • dt (jgdv.DateTime)

  • round (jgdv.Seconds)

Return type:

jgdv.DateTime