To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

cb_clock.py 1.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

16
17
18
import time
from callback import Callback

19
DEFAULT_FLOAT_PREC = 6
20
21
22
23
24
25
26
27
28
29
30
31
32
33

class ClockCallback(Callback):
    def __init__(self, param_s):
        self.data = []
        self.t0 = None
        self.prec = int(param_s) if param_s else DEFAULT_FLOAT_PREC

    def begin(self, **kwds):
        self.t0 = time.clock()

    def end(self, **kwds):
        t1 = time.clock()
        self.data.append(t1 - self.t0)

34
35
36
    def report(self):
        for flt in self.data:
            print(("%%.%df" % self.prec) % flt)