# Path: tuskar/openstack/common/timeutils.py
# _ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f'
# _ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
# PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND
# def isotime(at=None, subsecond=False):
# def parse_isotime(timestr):
# def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
# def parse_strtime(timestr, fmt=PERFECT_TIME_FORMAT):
# def normalize_time(timestamp):
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def utcnow_ts():
# def utcnow():
# def iso8601_from_timestamp(timestamp):
# def set_time_override(override_time=datetime.datetime.utcnow()):
# def advance_time_delta(timedelta):
# def advance_time_seconds(seconds):
# def clear_time_override():
# def marshall_now(now=None):
# def unmarshall_time(tyme):
# def delta_seconds(before, after):
# def is_soon(dt, window):


import datetime
import functools
import inspect
import itertools
import json
import types
import xmlrpclib
import six
    import anyjson
from tuskar.openstack.common import timeutils

    Handy for JSON serialization. We can optionally handle instances,
    but since this is a recursive function, we could have cyclical
    data structures.

    To handle cyclical data structures we could track the actual objects
    visited in a set, but not all objects are hashable. Instead we just
    track the depth of the object inspections and don't go too deep.

    Therefore, convert_instances=True is lossy ... be aware.

    """
    # handle obvious types first - order of basic types determined by running
    # full tests on nova project, resulting in the following counts:
    # 572754 <type 'NoneType'>
    # 460353 <type 'int'>
    # 379632 <type 'unicode'>
    # 274610 <type 'str'>
    # 199918 <type 'dict'>
    # 114200 <type 'datetime.datetime'>
    #  51817 <type 'bool'>
    #  26164 <type 'list'>
    #   6491 <type 'float'>
    #    283 <type 'tuple'>
    #     19 <type 'long'>
    if isinstance(value, _simple_types):
        return value

    if isinstance(value, datetime.datetime):
        if convert_datetime:

# Path: tuskar/openstack/common/timeutils.py
# _ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f'
# _ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
# PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND
# def isotime(at=None, subsecond=False):
# def parse_isotime(timestr):
# def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
# def parse_strtime(timestr, fmt=PERFECT_TIME_FORMAT):
# def normalize_time(timestamp):
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def utcnow_ts():
# def utcnow():
# def iso8601_from_timestamp(timestamp):
# def set_time_override(override_time=datetime.datetime.utcnow()):
# def advance_time_delta(timedelta):
# def advance_time_seconds(seconds):
# def clear_time_override():
# def marshall_now(now=None):
# def unmarshall_time(tyme):
# def delta_seconds(before, after):
# def is_soon(dt, window):


# Path: tuskar/openstack/common/jsonutils.py
import datetime
import functools
import inspect
import itertools
import json
import types
import xmlrpclib
import six
    import anyjson
from tuskar.openstack.common import timeutils


    Handy for JSON serialization. We can optionally handle instances,
    but since this is a recursive function, we could have cyclical
    data structures.

    To handle cyclical data structures we could track the actual objects
    visited in a set, but not all objects are hashable. Instead we just
    track the depth of the object inspections and don't go too deep.

    Therefore, convert_instances=True is lossy ... be aware.

    """
    # handle obvious types first - order of basic types determined by running
    # full tests on nova project, resulting in the following counts:
    # 572754 <type 'NoneType'>
    # 460353 <type 'int'>
    # 379632 <type 'unicode'>
    # 274610 <type 'str'>
    # 199918 <type 'dict'>
    # 114200 <type 'datetime.datetime'>
    #  51817 <type 'bool'>
    #  26164 <type 'list'>
    #   6491 <type 'float'>
    #    283 <type 'tuple'>
    #     19 <type 'long'>
    if isinstance(value, _simple_types):
        return value

    if isinstance(value, datetime.datetime):
        if convert_datetime:

            return timeutils.strtime(value)