Staging
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision b657f7ab6fceae6651d7340acd7896db91fad6a6 authored by Alain Leufroy on 30 January 2012, 08:22:40 UTC, committed by Alain Leufroy on 30 January 2012, 08:22:40 UTC
Giving a link like::

  `links infancy view open browser <e449146a687d7ca73520fc60e23c5e70b3eca92a>`_

results in `links in fancy view open browser <e449146a687d7ca73520fc60e23c5e70b3eca92a>`_
1 parent 99e78a2
Raw File
Tip revision: b657f7ab6fceae6651d7340acd7896db91fad6a6 authored by Alain Leufroy on 30 January 2012, 08:22:40 UTC
[qt] allow to pass node/rev/tag as link anchor (closes #87902)
Tip revision: b657f7a
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