Merge "Remove functions created for pre-six 1.7.0"

This commit is contained in:
Jenkins
2014-06-19 16:48:53 +00:00
committed by Gerrit Code Review
3 changed files with 6 additions and 23 deletions

View File

@@ -63,7 +63,7 @@ def locked(*args, **kwargs):
def decorator(f):
attr_name = kwargs.get('lock', '_lock')
@misc.wraps(f)
@six.wraps(f)
def wrapper(*args, **kwargs):
lock = getattr(args[0], attr_name)
if isinstance(lock, (tuple, list)):

View File

@@ -20,7 +20,6 @@ import contextlib
import copy
import datetime
import errno
import functools
import inspect
import keyword
import logging
@@ -233,21 +232,6 @@ def wallclock():
return time.time()
def wraps(fn):
"""Wraps a method and ensures the __wrapped__ attribute is set.
NOTE(harlowja): This will not be needed in python 3.2 or greater which
already has this built-in to its functools.wraps method.
"""
def wrapper(f):
f = functools.wraps(fn)(f)
f.__wrapped__ = getattr(fn, '__wrapped__', fn)
return f
return wrapper
def millis_to_datetime(milliseconds):
"""Converts number of milliseconds (from epoch) into a datetime object."""
return datetime.datetime.fromtimestamp(float(milliseconds) / 1000)

View File

@@ -17,13 +17,12 @@
import multiprocessing
import threading
import six
from six.moves import _thread
if six.PY2:
from thread import get_ident # noqa
else:
# In python3+ the get_ident call moved (whhhy??)
from threading import get_ident # noqa
def get_ident():
"""Return the 'thread identifier' of the current thread."""
return _thread.get_ident()
def get_optimal_thread_count():