Replace use of functools.wraps() with six.wraps()

In Python 2.7, functools.wraps() does not provide the '__wrapped__'
attribute. This attribute is used by
oslo_utils.reflection.get_signature() when getting the signature of a
function. If a function is decorated without the '__wrapped__'
attribute then the signature will be of the decorator rather than the
underlying function.

From the six documentation for six.wraps():
    This is exactly the functools.wraps() decorator, but it sets the
    __wrapped__ attribute on what it decorates as functools.wraps()
    does on Python versions after 3.2.

Change-Id: I6be901f8e01e0ff1b1e2b8c5197b320b5f8026fb
This commit is contained in:
John L. Villalovos 2018-02-01 16:31:15 -08:00
parent 6b7bc3289d
commit 67fac2f0aa
2 changed files with 2 additions and 4 deletions
ironicclient

@ -15,7 +15,6 @@
import copy
from distutils.version import StrictVersion
import functools
import hashlib
import logging
import os
@ -234,7 +233,7 @@ _RETRY_EXCEPTIONS = (exc.Conflict, exc.ServiceUnavailable,
def with_retries(func):
"""Wrapper for _http_request adding support for retries."""
@functools.wraps(func)
@six.wraps(func)
def wrapper(self, url, method, **kwargs):
if self.conflict_max_retries is None:
self.conflict_max_retries = DEFAULT_MAX_RETRIES

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import functools
import json
import jsonschema
@ -114,7 +113,7 @@ def create_single_handler(resource_type):
"""
def outer_wrapper(create_method):
@functools.wraps(create_method)
@six.wraps(create_method)
def wrapper(client, **params):
uuid = None
error = None