# Path: gtimer/private/focus.py
# def create_next_timer(*args, **kwargs):
# def remove_last_timer():
# def create_next_loop(*args, **kwargs):
# def remove_last_loop():
# def refresh_shortcuts():
# def hard_reset():
# def get_current_timer():
# 
# Path: gtimer/local/report.py
# def report(times,
#            include_itrs=True,
#            include_stats=True,
#            delim_mode=False,
#            format_options=None,
#            timer_state=None):
#     delim_mode = bool(delim_mode)
#     if format_options is None:
#         format_options = dict()
#     elif not isinstance(format_options, dict):
#         raise TypeError("Expected dictionary for param 'format_options'.")
#     _define_report_formats(delim_mode, format_options)
#     FMT = FMTS_RPT['Report']
#     rep = FMT['BEGIN'].format(times.name)
#     rep += _report_header(times, timer_state)
#     rep += FMT['INT']
#     rep += _report_stamps(times)
#     if include_itrs or include_stats:
#         rep_itr = _report_itrs(times, delim_mode, include_itrs, include_stats)
#         if rep_itr:
#             rep += FMT['ITR']
#             rep += rep_itr
#     rep += FMT['END'].format(times.name)
#     return rep
# 
# Path: gtimer/local/times.py
# 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):
#                 for sub in par_list:
#                     sub.parent = new
#         return new
# 
#     def reset(self):
#         self.stamps = Stamps()
#         self.total = 0.
#         self.stamps_sum = 0.
#         self.self_agg = 0.
#         self.subdvsn = dict()
#         self.par_subdvsn = dict()
#         self.par_in_parent = None
# 
# Path: gtimer/private/collapse.py
# def collapse_times():
# def _collapse_subdivision():
# def _copy_timer_stack():
# 
# Path: gtimer/util.py
# def iteritems(dictionary):
#     return dictionary.items()
# 
# def itervalues(dictionary):
#     return dictionary.values()


from timeit import default_timer as timer
from gtimer.private import focus as f
from gtimer.local import report as report_loc
from gtimer.local.times import Times
from gtimer.private import collapse
from gtimer.util import iteritems, itervalues
                                          delim_mode,
                                          format_options)
    else:
        if not isinstance(times_list, (list, tuple)):
            raise TypeError("Expected a list/tuple of times instances for param 'times_list'.")
        if not all([isinstance(times, Times) for times in times_list]):
            raise TypeError("At least one member of param 'times_list' is not a Times object.")
        rep = report_loc.compare(times_list,
                                 name,
                                 include_list,
                                 include_stats,
                                 delim_mode,
                                 format_options)
    return rep


def write_structure(times=None):
    """
    Produce a formatted record of a times data structure.

    Args:
        times (Times, optional): If not provided, uses the current root timer.

    Returns:
        str: Timer tree hierarchy in a formatted string.

    Raises:
        TypeError: If provided argument is not a Times object.
    """
    if times is None:

# Path: gtimer/private/focus.py
# def create_next_timer(*args, **kwargs):
# def remove_last_timer():
# def create_next_loop(*args, **kwargs):
# def remove_last_loop():
# def refresh_shortcuts():
# def hard_reset():
# def get_current_timer():
# 
# Path: gtimer/local/report.py
# def report(times,
#            include_itrs=True,
#            include_stats=True,
#            delim_mode=False,
#            format_options=None,
#            timer_state=None):
#     delim_mode = bool(delim_mode)
#     if format_options is None:
#         format_options = dict()
#     elif not isinstance(format_options, dict):
#         raise TypeError("Expected dictionary for param 'format_options'.")
#     _define_report_formats(delim_mode, format_options)
#     FMT = FMTS_RPT['Report']
#     rep = FMT['BEGIN'].format(times.name)
#     rep += _report_header(times, timer_state)
#     rep += FMT['INT']
#     rep += _report_stamps(times)
#     if include_itrs or include_stats:
#         rep_itr = _report_itrs(times, delim_mode, include_itrs, include_stats)
#         if rep_itr:
#             rep += FMT['ITR']
#             rep += rep_itr
#     rep += FMT['END'].format(times.name)
#     return rep
# 
# Path: gtimer/local/times.py
# 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):
#                 for sub in par_list:
#                     sub.parent = new
#         return new
# 
#     def reset(self):
#         self.stamps = Stamps()
#         self.total = 0.
#         self.stamps_sum = 0.
#         self.self_agg = 0.
#         self.subdvsn = dict()
#         self.par_subdvsn = dict()
#         self.par_in_parent = None
# 
# Path: gtimer/private/collapse.py
# def collapse_times():
# def _collapse_subdivision():
# def _copy_timer_stack():
# 
# Path: gtimer/util.py
# def iteritems(dictionary):
#     return dictionary.items()
# 
# def itervalues(dictionary):
#     return dictionary.values()


# Path: gtimer/public/report.py
from timeit import default_timer as timer
from gtimer.private import focus as f
from gtimer.local import report as report_loc
from gtimer.local.times import Times
from gtimer.private import collapse
from gtimer.util import iteritems, itervalues

                                          delim_mode,
                                          format_options)
    else:
        if not isinstance(times_list, (list, tuple)):
            raise TypeError("Expected a list/tuple of times instances for param 'times_list'.")
        if not all([isinstance(times, Times) for times in times_list]):
            raise TypeError("At least one member of param 'times_list' is not a Times object.")
        rep = report_loc.compare(times_list,
                                 name,
                                 include_list,
                                 include_stats,
                                 delim_mode,
                                 format_options)
    return rep


def write_structure(times=None):
    """
    Produce a formatted record of a times data structure.

    Args:
        times (Times, optional): If not provided, uses the current root timer.

    Returns:
        str: Timer tree hierarchy in a formatted string.

    Raises:
        TypeError: If provided argument is not a Times object.
    """
    if times is None:

        return report_loc.write_structure(f.root.times)