diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2019-07-27 16:08:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-07-27 16:08:58 +0000 |
commit | a79fbaad5fe507e6fce76c891d0793444be6d6e1 (patch) | |
tree | c53ea88a3ea828e5557bc2b9e4a002a2e0ee81dc | |
parent | ba70917a4dc40e7b789d2d1608cb718e352a82cd (diff) | |
parent | 6535ec6b95d3b3978fe52ea31523c7bd14f4e95b (diff) | |
download | external_python_mako-a79fbaad5fe507e6fce76c891d0793444be6d6e1.tar.gz external_python_mako-a79fbaad5fe507e6fce76c891d0793444be6d6e1.tar.bz2 external_python_mako-a79fbaad5fe507e6fce76c891d0793444be6d6e1.zip |
Merge "use timeit.default_timer instead of time.clock() / time.time()"
-rw-r--r-- | doc/build/unreleased/301.rst | 8 | ||||
-rw-r--r-- | mako/compat.py | 6 | ||||
-rw-r--r-- | mako/util.py | 5 | ||||
-rw-r--r-- | tox.ini | 1 |
4 files changed, 12 insertions, 8 deletions
diff --git a/doc/build/unreleased/301.rst b/doc/build/unreleased/301.rst new file mode 100644 index 0000000..7e9f1d2 --- /dev/null +++ b/doc/build/unreleased/301.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, py3k, windows + :tickets: 301 + + Replaced usage of time.clock() on windows as well as time.time() elsewhere + for microsecond timestamps with timeit.default_timer(), as time.clock() is + being removed in Python 3.8. Pull request courtesy Christoph Reiter. + diff --git a/mako/compat.py b/mako/compat.py index a3b1fd0..2444cad 100644 --- a/mako/compat.py +++ b/mako/compat.py @@ -6,7 +6,6 @@ import json # noqa import sys -import time py3k = sys.version_info >= (3, 0) py33 = sys.version_info >= (3, 3) @@ -141,11 +140,6 @@ except ImportError: else: import dummy_thread as thread # noqa -if win32 or jython: - time_func = time.clock -else: - time_func = time.time - try: from functools import partial except: diff --git a/mako/util.py b/mako/util.py index 4f1426d..07f7531 100644 --- a/mako/util.py +++ b/mako/util.py @@ -9,6 +9,7 @@ import collections import operator import os import re +import timeit from mako import compat @@ -180,7 +181,7 @@ class LRUCache(dict): def __init__(self, key, value): self.key = key self.value = value - self.timestamp = compat.time_func() + self.timestamp = timeit.default_timer() def __repr__(self): return repr(self.value) @@ -191,7 +192,7 @@ class LRUCache(dict): def __getitem__(self, key): item = dict.__getitem__(self, key) - item.timestamp = compat.time_func() + item.timestamp = timeit.default_timer() return item.value def values(self): @@ -29,6 +29,7 @@ deps= flake8-builtins flake8-docstrings flake8-rst-docstrings + pydocstyle<4.0.0 # used by flake8-rst-docstrings pygments commands = flake8 ./mako/ ./test/ setup.py --exclude test/templates,test/foo |