# 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/private/times.py
# def dump_times():
# def assign_subdivisions(position, keep_subdivisions=True):
# def _assign_subdvsn(position):
# def _assign_par_subdvsn(position):
# 
# Path: gtimer/public/timer.py
# SET = {'SI': True,  # save iterations
#        'KS': True,  # keep subdivisions
#        'QP': False,  # quick print
#        'UN': True,  # unique (stamp name)
#        }
#     SET['SI'] = setting
#     SET['KS'] = setting
#     SET['QP'] = setting
#     SET['UN'] = setting
# def start(backdate=None):
# def stamp(name, backdate=None,
#           unique=None, keep_subdivisions=None, quick_print=None,
#           un=None, ks=None, qp=None):
# def stop(name=None, backdate=None,
#          unique=None, keep_subdivisions=None, quick_print=None,
#          un=None, ks=None, qp=None):
# def pause():
# def resume():
# def blank_stamp(name=None, backdate=None,
#                 unique=None, keep_subdivisions=False, quick_print=None,
#                 un=None, ks=False, qp=None):
# def reset():
# def current_time():
# def wrap(func, subdivide=True, name=None, rgstr_stamps=None, save_itrs=None):
#         def gtimer_wrapped(*args, **kwargs):
#         def gtimer_wrapped(*args, **kwargs):
# def subdivide(name, rgstr_stamps=None, save_itrs=SET['SI']):
# def end_subdivision():
# def rename_root(name):
# def set_save_itrs_root(setting):
# def rgstr_stamps_root(rgstr_stamps):
# def reset_root():
# def is_timer_stopped():
# def is_timer_paused():
# def has_subdvsn_awaiting():
# def has_par_subdvsn_awaiting():
# def get_active_lineage():
# def set_def_save_itrs(setting):
# def set_def_keep_subdivisions(setting):
# def set_def_quick_print(setting):
# def set_def_unique(setting):
# def clear_subdvsn_awaiting():
# def clear_par_subdvsn_awaiting():
# def _stamp(name, elapsed, unique, keep_subdivisions, quick_print):
# def _loop_stamp(name, elapsed, unique=True):
# def _init_loop_stamp(name, unique=True, do_lp=True):
# def _auto_subdivide(name, rgstr_stamps=None, save_itrs=True):
# def _close_subdivision():
# def _end_auto_subdivision():
# 
# Path: gtimer/util.py
# def iteritems(dictionary):
#     return dictionary.items()
# 
# Path: gtimer/private/const.py
# UNASGN = 'UNASSIGNED'
# 
# Path: gtimer/local/exceptions.py
# class StoppedError(GTimerError):
#     pass
# 
# class PausedError(GTimerError):
#     pass
# 
# class LoopError(GTimerError):
#     pass


from timeit import default_timer as timer
from gtimer.private import focus as f
from gtimer.private import times as times_priv
from gtimer.public import timer as timer_pub
from gtimer.util import iteritems
from gtimer.private.const import UNASGN
from gtimer.local.exceptions import StoppedError, PausedError, LoopError
               save_itrs=True,
               keep_subdivisions=True):
    t = timer()
    f.t.last_t = t
    if f.t.stopped:
        raise StoppedError("Timer already stopped when entering loop.")
    if f.t.paused:
        raise PausedError("Timer paused when entering loop.")
    times_priv.assign_subdivisions(UNASGN, keep_subdivisions)
    if name is None:  # Entering anonynous loop.
        if f.t.in_loop:
            raise LoopError("Entering anonymous inner timed loop (not supported).")
        f.t.in_loop = True
        f.t.self_cut += timer() - t
    else:  # Entering a named loop.
        if not f.t.in_loop or name not in f.lp.stamps:  # double check this if-logic
            timer_pub._init_loop_stamp(name, do_lp=False)
            if save_itrs:
                f.s.itrs[name] = []
        if f.t.in_loop and name not in f.lp.stamps:
            f.lp.stamps.append(name)
        f.t.self_cut += timer() - t
        _subdivide_named_loop(name, rgstr_stamps, save_itrs=save_itrs)
    f.create_next_loop(name, rgstr_stamps, save_itrs)


def loop_start():
    if f.t.stopped:
        raise StoppedError("Timer already stopped at start of loop iteration.")
    if f.t.paused:

# 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/private/times.py
# def dump_times():
# def assign_subdivisions(position, keep_subdivisions=True):
# def _assign_subdvsn(position):
# def _assign_par_subdvsn(position):
# 
# Path: gtimer/public/timer.py
# SET = {'SI': True,  # save iterations
#        'KS': True,  # keep subdivisions
#        'QP': False,  # quick print
#        'UN': True,  # unique (stamp name)
#        }
#     SET['SI'] = setting
#     SET['KS'] = setting
#     SET['QP'] = setting
#     SET['UN'] = setting
# def start(backdate=None):
# def stamp(name, backdate=None,
#           unique=None, keep_subdivisions=None, quick_print=None,
#           un=None, ks=None, qp=None):
# def stop(name=None, backdate=None,
#          unique=None, keep_subdivisions=None, quick_print=None,
#          un=None, ks=None, qp=None):
# def pause():
# def resume():
# def blank_stamp(name=None, backdate=None,
#                 unique=None, keep_subdivisions=False, quick_print=None,
#                 un=None, ks=False, qp=None):
# def reset():
# def current_time():
# def wrap(func, subdivide=True, name=None, rgstr_stamps=None, save_itrs=None):
#         def gtimer_wrapped(*args, **kwargs):
#         def gtimer_wrapped(*args, **kwargs):
# def subdivide(name, rgstr_stamps=None, save_itrs=SET['SI']):
# def end_subdivision():
# def rename_root(name):
# def set_save_itrs_root(setting):
# def rgstr_stamps_root(rgstr_stamps):
# def reset_root():
# def is_timer_stopped():
# def is_timer_paused():
# def has_subdvsn_awaiting():
# def has_par_subdvsn_awaiting():
# def get_active_lineage():
# def set_def_save_itrs(setting):
# def set_def_keep_subdivisions(setting):
# def set_def_quick_print(setting):
# def set_def_unique(setting):
# def clear_subdvsn_awaiting():
# def clear_par_subdvsn_awaiting():
# def _stamp(name, elapsed, unique, keep_subdivisions, quick_print):
# def _loop_stamp(name, elapsed, unique=True):
# def _init_loop_stamp(name, unique=True, do_lp=True):
# def _auto_subdivide(name, rgstr_stamps=None, save_itrs=True):
# def _close_subdivision():
# def _end_auto_subdivision():
# 
# Path: gtimer/util.py
# def iteritems(dictionary):
#     return dictionary.items()
# 
# Path: gtimer/private/const.py
# UNASGN = 'UNASSIGNED'
# 
# Path: gtimer/local/exceptions.py
# class StoppedError(GTimerError):
#     pass
# 
# class PausedError(GTimerError):
#     pass
# 
# class LoopError(GTimerError):
#     pass


# Path: gtimer/private/loop.py
from timeit import default_timer as timer
from gtimer.private import focus as f
from gtimer.private import times as times_priv
from gtimer.public import timer as timer_pub
from gtimer.util import iteritems
from gtimer.private.const import UNASGN
from gtimer.local.exceptions import StoppedError, PausedError, LoopError

               save_itrs=True,
               keep_subdivisions=True):
    t = timer()
    f.t.last_t = t
    if f.t.stopped:
        raise StoppedError("Timer already stopped when entering loop.")
    if f.t.paused:
        raise PausedError("Timer paused when entering loop.")
    times_priv.assign_subdivisions(UNASGN, keep_subdivisions)
    if name is None:  # Entering anonynous loop.
        if f.t.in_loop:
            raise LoopError("Entering anonymous inner timed loop (not supported).")
        f.t.in_loop = True
        f.t.self_cut += timer() - t
    else:  # Entering a named loop.
        if not f.t.in_loop or name not in f.lp.stamps:  # double check this if-logic
            timer_pub._init_loop_stamp(name, do_lp=False)
            if save_itrs:
                f.s.itrs[name] = []
        if f.t.in_loop and name not in f.lp.stamps:
            f.lp.stamps.append(name)
        f.t.self_cut += timer() - t
        _subdivide_named_loop(name, rgstr_stamps, save_itrs=save_itrs)
    f.create_next_loop(name, rgstr_stamps, save_itrs)


def loop_start():
    if f.t.stopped:
        raise StoppedError("Timer already stopped at start of loop iteration.")
    if f.t.paused:

        raise PausedError("Timer paused at start of loop iteration.")