renamed time from time package to pytime
This commit is contained in:
parent
c40ea052b8
commit
43ac510e7d
@ -2,7 +2,7 @@
|
|||||||
Collection of utility functions.
|
Collection of utility functions.
|
||||||
"""
|
"""
|
||||||
import functools
|
import functools
|
||||||
from time import time
|
from time import time as pytime
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -492,9 +492,9 @@ def fibonacci_sphere(samples=1000):
|
|||||||
def timing(function):
|
def timing(function):
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def wrap(*args, **kw):
|
def wrap(*args, **kw):
|
||||||
start_time = time()
|
start_time = pytime()
|
||||||
result = function(*args, **kw)
|
result = function(*args, **kw)
|
||||||
end_time = time()
|
end_time = pytime()
|
||||||
time_needed = end_time - start_time
|
time_needed = end_time - start_time
|
||||||
print(f"Finished in {int(time_needed // 60)} min " f"{int(time_needed % 60)} s")
|
print(f"Finished in {int(time_needed // 60)} min " f"{int(time_needed % 60)} s")
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user