Staging
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision e7664752291100739701cdf1fcfee2a39c8d04bc authored by Takumi IINO on 18 June 2012, 14:01:26 UTC, committed by Takumi IINO on 18 June 2012, 14:01:26 UTC
hgviewlib.curses.mainframe.Footer dose not have ``footer`` attribute.
1 parent 30050b4
Raw File
Tip revision: e7664752291100739701cdf1fcfee2a39c8d04bc authored by Takumi IINO on 18 June 2012, 14:01:26 UTC
[tui] call ``set`` directly instead of ``footer`` attribute that does not exist (closes #98669)
Tip revision: e766475
decorators.py
# -*- coding: utf-8 -*-
"""
Some useful decorator functions
"""
import time

def timeit(func):
    """Decorator used to time the execution of a function"""
    def timefunc(*args, **kwargs):
        """wrapper"""
        t_1 = time.time()
        t_2 = time.clock()
        res = func(*args, **kwargs)
        t_3 = time.clock()
        t_4 = time.time()
        print "%s: %.2fms (time) %.2fms (clock)" % \
              (func.func_name, 1000*(t_3 - t_2), 1000*(t_4 - t_1))
        return res
    return timefunc
back to top