# 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/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/util.py
# def opt_arg_wrap(inner_wrap):
#     def wrapped_dec(*args, **kwargs):
#         if len(args) == 1 and callable(args[0]):
#             return inner_wrap(args[0])
#         else:
#             def gtimer_wrapped_arg(func):
#                 return inner_wrap(func, *args, **kwargs)
#             return gtimer_wrapped_arg
#     return wrapped_dec
# 
# Path: gtimer/private/const.py
# UNASGN = 'UNASSIGNED'
# 
# Path: gtimer/local/exceptions.py
# class StartError(GTimerError):
#     pass
# 
# class StoppedError(GTimerError):
#     pass
# 
# class PausedError(GTimerError):
#     pass
# 
# class LoopError(GTimerError):
#     pass
# 
# class GTimerError(Exception):
#     pass
# 
# class UniqueNameError(GTimerError):
#     pass
# 
# class BackdateError(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.local.util import sanitize_rgstr_stamps
from gtimer.util import opt_arg_wrap
from gtimer.private.const import UNASGN
from gtimer.local.exceptions import (StartError, StoppedError, PausedError,
                                     LoopError, GTimerError, UniqueNameError,
                                     BackdateError)
#
# Core timer functions.
#


def start(backdate=None):
    """
    Mark the start of timing, overwriting the automatic start data written on
    import, or the automatic start at the beginning of a subdivision.

    Notes:
        Backdating: For subdivisions only.  Backdate time must be in the past
        but more recent than the latest stamp in the parent timer.

    Args:
        backdate (float, optional): time to use for start instead of current.

    Returns:
        float: The current time.

    Raises:
        BackdateError: If given backdate time is out of range or used in root timer.
        StartError: If the timer is not in a pristine state (if any stamps or
            subdivisions, must reset instead).
        StoppedError: If the timer is already stopped (must reset instead).
        TypeError: If given backdate value is not type float.
    """
    if f.s.cum:
        raise StartError("Already have stamps, can't start again (must reset).")
    if f.t.subdvsn_awaiting or f.t.par_subdvsn_awaiting:

# 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/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/util.py
# def opt_arg_wrap(inner_wrap):
#     def wrapped_dec(*args, **kwargs):
#         if len(args) == 1 and callable(args[0]):
#             return inner_wrap(args[0])
#         else:
#             def gtimer_wrapped_arg(func):
#                 return inner_wrap(func, *args, **kwargs)
#             return gtimer_wrapped_arg
#     return wrapped_dec
# 
# Path: gtimer/private/const.py
# UNASGN = 'UNASSIGNED'
# 
# Path: gtimer/local/exceptions.py
# class StartError(GTimerError):
#     pass
# 
# class StoppedError(GTimerError):
#     pass
# 
# class PausedError(GTimerError):
#     pass
# 
# class LoopError(GTimerError):
#     pass
# 
# class GTimerError(Exception):
#     pass
# 
# class UniqueNameError(GTimerError):
#     pass
# 
# class BackdateError(GTimerError):
#     pass


# Path: gtimer/public/timer.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.local.util import sanitize_rgstr_stamps
from gtimer.util import opt_arg_wrap
from gtimer.private.const import UNASGN
from gtimer.local.exceptions import (StartError, StoppedError, PausedError,
                                     LoopError, GTimerError, UniqueNameError,
                                     BackdateError)

#
# Core timer functions.
#


def start(backdate=None):
    """
    Mark the start of timing, overwriting the automatic start data written on
    import, or the automatic start at the beginning of a subdivision.

    Notes:
        Backdating: For subdivisions only.  Backdate time must be in the past
        but more recent than the latest stamp in the parent timer.

    Args:
        backdate (float, optional): time to use for start instead of current.

    Returns:
        float: The current time.

    Raises:
        BackdateError: If given backdate time is out of range or used in root timer.
        StartError: If the timer is not in a pristine state (if any stamps or
            subdivisions, must reset instead).
        StoppedError: If the timer is already stopped (must reset instead).
        TypeError: If given backdate value is not type float.
    """
    if f.s.cum:
        raise StartError("Already have stamps, can't start again (must reset).")
    if f.t.subdvsn_awaiting or f.t.par_subdvsn_awaiting:

        raise StartError("Already have subdivisions, can't start again (must reset).")