# Path: gtimer/private/loop.py
# def enter_loop(name=None,
#                rgstr_stamps=None,
#                save_itrs=True,
#                keep_subdivisions=True):
# def loop_start():
# def loop_end(loop_end_stamp=None,
#              end_stamp_unique=True,
#              keep_subdivisions=True,
#              quick_print=False):
# def exit_loop():
# def _subdivide_named_loop(name, rgstr_stamps, save_itrs):
# def _end_subdivision_named_loop():
# 
# Path: gtimer/private/focus.py
# def get_current_timer():
#     global t
#     return t
# 
# Path: gtimer/local/util.py
# def sanitize_rgstr_stamps(rgstr_stamps=None):
#     if rgstr_stamps is not None:
#         if not isinstance(rgstr_stamps, (list, tuple)):
#             raise TypeError("Expected list or tuple for param 'rgstr_stamps' (elements passed through str()).")
#         rgstr_stamps = list(set(rgstr_stamps))
#         for s in rgstr_stamps:
#             s = str(s)
#     else:
#         rgstr_stamps = list()
#     return rgstr_stamps
# 
# Path: gtimer/local/exceptions.py
# class LoopError(GTimerError):
#     pass


from gtimer.private import loop
from gtimer.private.focus import get_current_timer
from gtimer.local.util import sanitize_rgstr_stamps
from gtimer.local.exceptions import LoopError
            if get_current_timer() is not self._timer:
                raise LoopError("Loop timer mismatch, likely improper subdivision during loop (cannot span iterations).")
            loop.loop_end(self._loop_end_stamp,
                          self._end_stamp_unique,
                          self._keep_end_subdivisions,
                          self._quick_print)
        loop.loop_start()

    __next__ = next


class TimedFor(TimedLoopBase):

    def __init__(self, iterable, *args, **kwargs):
        self._iterable = iterable
        super(TimedFor, self).__init__(*args, **kwargs)

    def __iter__(self):
        if self._exited:
            raise LoopError("For-loop object already exited (need a new loop object).")
        loop.enter_loop(self._name,
                        self._rgstr_stamps,
                        self._save_itrs,
                        self._keep_prev_subdivisions)
        self._timer = get_current_timer()
        for i in self._iterable:
            loop.loop_start()
            self._started = True
            yield i
            if self._exited:

# Path: gtimer/private/loop.py
# def enter_loop(name=None,
#                rgstr_stamps=None,
#                save_itrs=True,
#                keep_subdivisions=True):
# def loop_start():
# def loop_end(loop_end_stamp=None,
#              end_stamp_unique=True,
#              keep_subdivisions=True,
#              quick_print=False):
# def exit_loop():
# def _subdivide_named_loop(name, rgstr_stamps, save_itrs):
# def _end_subdivision_named_loop():
# 
# Path: gtimer/private/focus.py
# def get_current_timer():
#     global t
#     return t
# 
# Path: gtimer/local/util.py
# def sanitize_rgstr_stamps(rgstr_stamps=None):
#     if rgstr_stamps is not None:
#         if not isinstance(rgstr_stamps, (list, tuple)):
#             raise TypeError("Expected list or tuple for param 'rgstr_stamps' (elements passed through str()).")
#         rgstr_stamps = list(set(rgstr_stamps))
#         for s in rgstr_stamps:
#             s = str(s)
#     else:
#         rgstr_stamps = list()
#     return rgstr_stamps
# 
# Path: gtimer/local/exceptions.py
# class LoopError(GTimerError):
#     pass


# Path: gtimer/private/timedloop.py
from gtimer.private import loop
from gtimer.private.focus import get_current_timer
from gtimer.local.util import sanitize_rgstr_stamps
from gtimer.local.exceptions import LoopError

            if get_current_timer() is not self._timer:
                raise LoopError("Loop timer mismatch, likely improper subdivision during loop (cannot span iterations).")
            loop.loop_end(self._loop_end_stamp,
                          self._end_stamp_unique,
                          self._keep_end_subdivisions,
                          self._quick_print)
        loop.loop_start()

    __next__ = next


class TimedFor(TimedLoopBase):

    def __init__(self, iterable, *args, **kwargs):
        self._iterable = iterable
        super(TimedFor, self).__init__(*args, **kwargs)

    def __iter__(self):
        if self._exited:
            raise LoopError("For-loop object already exited (need a new loop object).")
        loop.enter_loop(self._name,
                        self._rgstr_stamps,
                        self._save_itrs,
                        self._keep_prev_subdivisions)
        self._timer = get_current_timer()
        for i in self._iterable:
            loop.loop_start()
            self._started = True
            yield i
            if self._exited:

                raise LoopError("Loop mechanism exited improperly (must break).")