Your ROOT_URL in app.ini is https://git.hpc.odu.edu/ but you are visiting https://git.wahab.hpc.odu.edu/wirawan0/wpylib/commit/56b5d9ed05c298671fb8f6484c66aff8c9a88c0d?style=unified&whitespace=show-all
You should set ROOT_URL correctly, otherwise the web may not work correctly.
1 changed files with
16 additions and
7 deletions
timer.py
@ -16,6 +16,7 @@ Simple timer utility.
This module is part of wpylib project .
"""
import sys
import time
class timer :
@ -38,6 +39,12 @@ class block_timer(object):
with block_timer ( ) as t :
< code >
Fancy options are available to record the timing result , specified when
initializing the new object :
* report = block_timer . writeout_file : : writes out the timing result to a file
* report = block_timer . writeout_dict : : saves the timing result to a dict - like element
"""
@staticmethod
def writeout_file ( out ) :
@ -49,21 +56,23 @@ class block_timer(object):
return wrt_dict
#return lambda tm: rec.__setitem__(key, tm)
@staticmethod
def bt_file ( fobj ) :
@classmethod
def bt_file ( cls , fobj ) :
""" An object factory to report the timing to a text file.
"""
if isinstance ( fobj , basestring ) :
from wpylib . iofmt . text_output import text_output
out = text_output ( fobj )
else :
out = fobj
return block_timer ( report = block_timer . writeout_file ( out ) )
return cls ( report = block_timer . writeout_file ( out ) )
@static method
def bt_dict ( rec , key ) :
return block_timer ( report = block_timer . writeout_dict ( rec , key ) )
@class method
def bt_dict ( cls , rec , key ) :
return cls ( report = block_timer . writeout_dict ( rec , key ) )
def __init__ ( self , report = None ) :
if report == None : report = block_timer . writeout_file ( sys . stdout )
if report is None : report = block_timer . writeout_file ( sys . stdout )
self . report = report
def __enter__ ( self ) :