Esempio n. 1
0
File: init.py Progetto: xk/bits
def current_time():
    global start
    return _bits._time()-start
Esempio n. 2
0
def current_time():
    global start
    return _bits._time() - start
Esempio n. 3
0
File: init.py Progetto: xk/bits
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Portions based on site.py from Python 2.6, under the Python license.

"""Python initialization, to run at BITS startup."""

import _bits

start = _bits._time()

def current_time():
    global start
    return _bits._time()-start

def time_prefix():
    return "[{:02.02f}]".format(current_time())

class import_annotation(object):
    def __init__(self, modname):
        self.modname = modname

    # Context management protocol
    def __enter__(self):
        print "{} Import {}".format(time_prefix(), self.modname)
Esempio n. 4
0
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Portions based on site.py from Python 2.6, under the Python license.
"""Python initialization, to run at BITS startup."""

import _bits

start = _bits._time()


def current_time():
    global start
    return _bits._time() - start


def time_prefix():
    return "[{:02.02f}]".format(current_time())


class import_annotation(object):
    def __init__(self, modname):
        self.modname = modname