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:
parent
6b7bc3289d
commit
67fac2f0aa
ironicclient
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
import functools
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -234,7 +233,7 @@ _RETRY_EXCEPTIONS = (exc.Conflict, exc.ServiceUnavailable,
|
|||||||
|
|
||||||
def with_retries(func):
|
def with_retries(func):
|
||||||
"""Wrapper for _http_request adding support for retries."""
|
"""Wrapper for _http_request adding support for retries."""
|
||||||
@functools.wraps(func)
|
@six.wraps(func)
|
||||||
def wrapper(self, url, method, **kwargs):
|
def wrapper(self, url, method, **kwargs):
|
||||||
if self.conflict_max_retries is None:
|
if self.conflict_max_retries is None:
|
||||||
self.conflict_max_retries = DEFAULT_MAX_RETRIES
|
self.conflict_max_retries = DEFAULT_MAX_RETRIES
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import functools
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import jsonschema
|
import jsonschema
|
||||||
@ -114,7 +113,7 @@ def create_single_handler(resource_type):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def outer_wrapper(create_method):
|
def outer_wrapper(create_method):
|
||||||
@functools.wraps(create_method)
|
@six.wraps(create_method)
|
||||||
def wrapper(client, **params):
|
def wrapper(client, **params):
|
||||||
uuid = None
|
uuid = None
|
||||||
error = None
|
error = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user