# Path: feet/utils/timez.py
# class Timer(object):
#     """
#     A context object timer. Usage:
#         >>> with Timer() as timer:
#         ...     do_something()
#         >>> print timer.elapsed
#     """
# 
#     def __init__(self, wall_clock=True):
#         """
#         If wall_clock is True then use time.time() to get the number of
#         actually elapsed seconds. If wall_clock is False, use time.clock to
#         get the process time instead.
#         """
#         self.wall_clock = wall_clock
#         self.time = time.time if wall_clock else time.clock
# 
#         # Stubs for serializing an empty timer.
#         self.started = None
#         self.finished = None
#         self.elapsed = 0.0
# 
#     def __enter__(self):
#         self.started = self.time()
#         return self
# 
#     def __exit__(self, typ, value, tb):
#         self.finished = self.time()
#         self.elapsed = self.finished - self.started
# 
#     def __str__(self):
#         return humanizedelta(seconds=self.elapsed)
# 
# Path: feet/exceptions.py
# class FeetError(Exception):
#     """The root of all errors in Feet library"""
#     pass
# 
# class TimeoutError(Exception):
#     """
#     An operation timed out
#     """
#     pass


import signal
from functools import wraps
from feet.utils.timez import Timer
from feet.exceptions import FeetError, TimeoutError


def memoized(fget):
    """
    Return a property attribute for new-style classes that only calls its
    getter on the first access. The result is stored and on subsequent
    accesses is returned, preventing the need to call the getter any more.
    https://github.com/estebistec/python-memoized-property
    """
    attr_name = '_{0}'.format(fget.__name__)

    @wraps(fget)
    def fget_memoized(self):
        if not hasattr(self, attr_name):
            setattr(self, attr_name, fget(self))
        return getattr(self, attr_name)

    return property(fget_memoized)


def timeit(func):
    """
    Returns the number of seconds that a function took along with the result
    """

    @wraps(func)
    def timer_wrapper(*args, **kwargs):
        """
        Inner function that uses the Timer context object
        """

# Path: feet/utils/timez.py
# class Timer(object):
#     """
#     A context object timer. Usage:
#         >>> with Timer() as timer:
#         ...     do_something()
#         >>> print timer.elapsed
#     """
# 
#     def __init__(self, wall_clock=True):
#         """
#         If wall_clock is True then use time.time() to get the number of
#         actually elapsed seconds. If wall_clock is False, use time.clock to
#         get the process time instead.
#         """
#         self.wall_clock = wall_clock
#         self.time = time.time if wall_clock else time.clock
# 
#         # Stubs for serializing an empty timer.
#         self.started = None
#         self.finished = None
#         self.elapsed = 0.0
# 
#     def __enter__(self):
#         self.started = self.time()
#         return self
# 
#     def __exit__(self, typ, value, tb):
#         self.finished = self.time()
#         self.elapsed = self.finished - self.started
# 
#     def __str__(self):
#         return humanizedelta(seconds=self.elapsed)
# 
# Path: feet/exceptions.py
# class FeetError(Exception):
#     """The root of all errors in Feet library"""
#     pass
# 
# class TimeoutError(Exception):
#     """
#     An operation timed out
#     """
#     pass


# Path: feet/utils/decorators.py
import signal
from functools import wraps
from feet.utils.timez import Timer
from feet.exceptions import FeetError, TimeoutError



def memoized(fget):
    """
    Return a property attribute for new-style classes that only calls its
    getter on the first access. The result is stored and on subsequent
    accesses is returned, preventing the need to call the getter any more.
    https://github.com/estebistec/python-memoized-property
    """
    attr_name = '_{0}'.format(fget.__name__)

    @wraps(fget)
    def fget_memoized(self):
        if not hasattr(self, attr_name):
            setattr(self, attr_name, fget(self))
        return getattr(self, attr_name)

    return property(fget_memoized)


def timeit(func):
    """
    Returns the number of seconds that a function took along with the result
    """

    @wraps(func)
    def timer_wrapper(*args, **kwargs):
        """
        Inner function that uses the Timer context object
        """

        with Timer() as timer: