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): def decorator(f):
attr_name = kwargs.get('lock', '_lock') attr_name = kwargs.get('lock', '_lock')
@misc.wraps(f) @six.wraps(f)
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
lock = getattr(args[0], attr_name) lock = getattr(args[0], attr_name)
if isinstance(lock, (tuple, list)): if isinstance(lock, (tuple, list)):

View File

@@ -20,7 +20,6 @@ import contextlib
import copy import copy
import datetime import datetime
import errno import errno
import functools
import inspect import inspect
import keyword import keyword
import logging import logging
@@ -233,21 +232,6 @@ def wallclock():
return time.time() 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): def millis_to_datetime(milliseconds):
"""Converts number of milliseconds (from epoch) into a datetime object.""" """Converts number of milliseconds (from epoch) into a datetime object."""
return datetime.datetime.fromtimestamp(float(milliseconds) / 1000) return datetime.datetime.fromtimestamp(float(milliseconds) / 1000)

View File

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