Convert functools.wraps() usage to six.wraps()
Convert usage of functools.wraps() to six.wraps() which sets the '__wrapped__' attribute as is done in Python 3.2 and later. Change-Id: I3ce7f934c09f8cbdf9eab04f88c57d66a6ccc794
This commit is contained in:
parent
fbd1d7c9ba
commit
48bf4348ce
@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import functools
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@ -61,7 +60,7 @@ def _translate_plain_exception(exc_value):
|
||||
|
||||
def check_image_service(func):
|
||||
"""Creates a glance client if doesn't exists and calls the function."""
|
||||
@functools.wraps(func)
|
||||
@six.wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
"""Wrapper around methods calls.
|
||||
|
||||
|
@ -94,13 +94,12 @@ raised in the background thread.):
|
||||
|
||||
"""
|
||||
|
||||
import functools
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
import retrying
|
||||
import six
|
||||
|
||||
from ironic.common import driver_factory
|
||||
from ironic.common import exception
|
||||
@ -121,7 +120,7 @@ def require_exclusive_lock(f):
|
||||
as the first parameter after "self".
|
||||
|
||||
"""
|
||||
@functools.wraps(f)
|
||||
@six.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
# NOTE(dtantsur): this code could be written simpler, but then unit
|
||||
# testing decorated functions is pretty hard, as we usually pass a Mock
|
||||
|
@ -20,7 +20,6 @@ Abstract base classes for drivers.
|
||||
import abc
|
||||
import collections
|
||||
import copy
|
||||
import functools
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
@ -624,7 +623,7 @@ def _passthru(http_methods, method=None, async=True, driver_passthru=False,
|
||||
|
||||
passthru_logmessage = _LE('vendor_passthru failed with method %s')
|
||||
|
||||
@functools.wraps(func)
|
||||
@six.wraps(func)
|
||||
def passthru_handler(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
@ -1043,7 +1042,7 @@ def driver_periodic_task(parallel=True, **other):
|
||||
semaphore = eventlet.semaphore.BoundedSemaphore()
|
||||
|
||||
def decorator2(func):
|
||||
@functools.wraps(func)
|
||||
@six.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
if parallel:
|
||||
def _internal():
|
||||
|
@ -16,10 +16,9 @@
|
||||
Ironic Cisco UCSM helper functions
|
||||
"""
|
||||
|
||||
import functools
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -55,7 +54,7 @@ def requires_ucs_client(func):
|
||||
mentioned above before and after calling the actual function.
|
||||
"""
|
||||
|
||||
@functools.wraps(func)
|
||||
@six.wraps(func)
|
||||
def wrapper(self, task, *args, **kwargs):
|
||||
if kwargs.get('helper') is None:
|
||||
kwargs['helper'] = CiscoUcsHelper(task)
|
||||
|
Loading…
Reference in New Issue
Block a user