# Path: gtimer/util.py
# def itervalues(dictionary):
#     return dictionary.values()


import copy
from gtimer.util import itervalues



class Times(object):
    """ Timing data resides here, including tree structure.
    (Survives after timing is complete).
    """

    def __init__(self,
                 name=None,
                 parent=None,
                 pos_in_parent=None,
                 save_itrs=True):
        self.name = None if name is None else str(name)
        self.parent = parent  # refer to another Times instance.
        self.pos_in_parent = pos_in_parent  # refers to a stamp name.
        self.save_itrs = save_itrs
        self.reset()

    def __deepcopy__(self, memo):
        new = type(self)()
        new.__dict__.update(self.__dict__)
        new.stamps = copy.deepcopy(self.stamps, memo)
        new.subdvsn = copy.deepcopy(new.subdvsn, memo)
        new.par_subdvsn = copy.deepcopy(self.par_subdvsn, memo)
        # Avoid deepcopy of parent, and update that attribute.
        for sub_list in itervalues(new.subdvsn):
            for sub in sub_list:
                sub.parent = new
        for par_dict in itervalues(new.par_subdvsn):

# Path: gtimer/util.py
# def itervalues(dictionary):
#     return dictionary.values()


# Path: gtimer/local/times.py
import copy
from gtimer.util import itervalues




class Times(object):
    """ Timing data resides here, including tree structure.
    (Survives after timing is complete).
    """

    def __init__(self,
                 name=None,
                 parent=None,
                 pos_in_parent=None,
                 save_itrs=True):
        self.name = None if name is None else str(name)
        self.parent = parent  # refer to another Times instance.
        self.pos_in_parent = pos_in_parent  # refers to a stamp name.
        self.save_itrs = save_itrs
        self.reset()

    def __deepcopy__(self, memo):
        new = type(self)()
        new.__dict__.update(self.__dict__)
        new.stamps = copy.deepcopy(self.stamps, memo)
        new.subdvsn = copy.deepcopy(new.subdvsn, memo)
        new.par_subdvsn = copy.deepcopy(self.par_subdvsn, memo)
        # Avoid deepcopy of parent, and update that attribute.
        for sub_list in itervalues(new.subdvsn):
            for sub in sub_list:
                sub.parent = new
        for par_dict in itervalues(new.par_subdvsn):

            for par_list in itervalues(par_dict):