Module Expr Str Import alias ImportFrom alias alias Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Assign NameStore TupleLoad TupleLoad NameLoad Str TupleLoad NameLoad Str TupleLoad NameLoad Str TupleLoad NameLoad Str TupleLoad NameLoad Str FunctionDef arguments args defaults body Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad Return BinOpSub NameLoad Call NameLoad keyword Num decorator_list FunctionDef arguments args NameParam defaults NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad Return BinOpSub NameLoad Call NameLoad keyword Num decorator_list FunctionDef arguments args NameParam defaults NameLoad body If UnaryOpNot NameLoad body Assign NameStore Call NameLoad Return Call NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq NameLoad NameLoad body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpSub AttributeLoad NameLoad attr BinOpMod AttributeLoad NameLoad attr Num orelse If CompareEq NameLoad NameLoad body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If CompareEq NameLoad NameLoad body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpSub AttributeLoad NameLoad attr BinOpMod AttributeLoad NameLoad attr Num orelse If CompareEq NameLoad NameLoad body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If CompareEq NameLoad NameLoad body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Raise Call NameLoad Call AttributeLoad Str attr keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Return Call Call NameLoad NameLoad Str Return BinOpDiv BinOpAdd AttributeLoad NameLoad attr BinOpMult BinOpAdd AttributeLoad NameLoad attr BinOpMult BinOpMult AttributeLoad NameLoad attr Num Num BinOpPow Num Num Call NameLoad BinOpPow Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore Dict Str Str Str Str Str Str Str Num Num Num Num BinOpMult Num Num BinOpMult Num Num BinOpMult Num Num Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Num While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign TupleStore NameStore NameStore TupleLoad Call NameLoad Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str If BoolOpAnd CompareGt NameLoad Num CompareIn NameLoad NameLoad body AugAssignAdd NameStore BinOpMult NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Slice Call AttributeLoad NameLoad attr orelse Raise Call NameLoad NameLoad orelse Raise Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad Assign NameStore Call NameLoad keyword Call NameLoad NameLoad Return BinOpSub NameLoad NameLoad decorator_list
N/A N/A 
Copyright (c) 2013 Thomas Sileo
Copyright (c) 2012 Steven Buss
Originally from:
https://github.com/sbuss/pypercube/blob/master/pypercube/time_utils.py
 N/A re datetime datetime timedelta N/A STEP_10_SEC N/A long 10000.0 N/A STEP_1_MIN N/A long 60000.0 N/A STEP_5_MIN N/A long 300000.0 N/A STEP_1_HOUR N/A long 3600000.0 N/A STEP_1_DAY N/A long 86400000.0 N/A STEP_CHOICES N/A N/A STEP_10_SEC 10 seconds N/A STEP_1_MIN 1 minute N/A STEP_5_MIN 5 minutes N/A STEP_1_HOUR 1 hour N/A STEP_1_DAY 1 day now N/A N/A N/A N/A N/A N/A N/A datetime utcnow N/A yesterday N/A N/A start N/A None N/A N/A N/A start None N/A N/A start N/A now N/A N/A start N/A timedelta days 1 N/A last_week N/A N/A start N/A None N/A N/A N/A start None N/A N/A start N/A now N/A N/A start N/A timedelta days 7 N/A start_of_month N/A N/A timestamp N/A None N/A N/A N/A timestamp N/A N/A timestamp N/A now N/A N/A datetime year N/A timestamp year month N/A timestamp month day 1 N/A floor N/A N/A start resolution N/A N/A N/A Floor a datetime by a resolution.

    >>> now = datetime(2012, 7, 6, 20, 33, 16, 573225)
    >>> floor(now, STEP_1_HOUR)
    datetime.datetime(2012, 7, 6, 20, 0)
     N/A N/A resolution STEP_10_SEC N/A N/A N/A datetime N/A start year N/A start month N/A start day N/A start hour N/A start minute N/A N/A start second N/A N/A start second 10 N/A N/A N/A resolution STEP_1_MIN N/A N/A N/A datetime N/A start year N/A start month N/A start day N/A start hour N/A start minute N/A N/A N/A resolution STEP_5_MIN N/A N/A N/A datetime N/A start year N/A start month N/A start day N/A start hour N/A N/A start minute N/A N/A start minute 5 N/A N/A N/A resolution STEP_1_HOUR N/A N/A N/A datetime N/A start year N/A start month N/A start day N/A start hour N/A N/A N/A resolution STEP_1_DAY N/A N/A N/A datetime N/A start year N/A start month N/A start day N/A N/A ValueError N/A N/A {resolution} is not a valid resolution. Valid choices are {choices} format resolution resolution choices STEP_CHOICES N/A _timedelta_total_seconds N/A N/A td N/A N/A N/A Python 2.6 backward compatibility function for timedelta.total_seconds.

    :type td: timedelta object
    :param td: timedelta object

    :rtype: float
    :return: The total number of seconds for the given timedelta object.

     N/A N/A hasattr timedelta total_seconds N/A N/A N/A N/A getattr td total_seconds N/A N/A N/A N/A td microseconds N/A N/A N/A td seconds N/A N/A N/A td days 24 3600 N/A 10 6 N/A float N/A 10 6 N/A _interval_string_to_seconds N/A N/A interval_string N/A N/A N/A Convert internal string like 1M, 1Y3M, 3W to seconds.

    :type interval_string: str
    :param interval_string: Interval string like 1M, 1W, 1M3W4h2s...
        (s => seconds, m => minutes, h => hours, D => days,
         W => weeks, M => months, Y => Years).

    :rtype: int
    :return: The conversion in seconds of interval_string.

     N/A interval_exc N/A N/A Bad interval format for {0} format interval_string N/A interval_dict N/A s m h D W M Y 1 60 3600 86400 N/A 7 86400 N/A 30 86400 N/A 365 86400 N/A interval_regex N/A N/A re compile ^(?P<num>[0-9]+)(?P<ext>[smhDWMY]) N/A seconds 0 N/A interval_string N/A N/A match N/A N/A interval_regex match interval_string N/A match N/A N/A N/A num ext N/A N/A int N/A N/A match group num N/A N/A match group ext N/A N/A N/A num 0 N/A ext interval_dict N/A N/A seconds N/A num N/A interval_dict N/A ext N/A interval_string N/A interval_string N/A N/A N/A match end N/A N/A N/A Exception interval_exc N/A N/A N/A Exception interval_exc N/A seconds N/A timeago N/A N/A interval_string start N/A None N/A N/A N/A start None N/A N/A start N/A now N/A td N/A timedelta seconds N/A _interval_string_to_seconds interval_string N/A N/A start td N/A