Commit 0663f9d3 authored by Jérome Perrin's avatar Jérome Perrin

component/pylint: backport an astroid patch for redundant-keyword-arg false positive

parent b336f593
From c13857606dda6be0d48a3f40d7466391b5ab951b Mon Sep 17 00:00:00 2001
From: Claudiu Popa <pcmanticore@gmail.com>
Date: Wed, 26 Aug 2015 20:51:18 +0300
Subject: [PATCH] functools.wraps needs to be called with the decorated
function and the implementation of cached decorator was passing the bad
arguments (grafted from 2a66d7f8cf83616b3eac63bcae61efe655678ab7)
--HG--
branch : 1.4.0
---
astroid/bases.py | 1 +
astroid/decorators.py | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/astroid/bases.py b/astroid/bases.py
index 90d1e4d6..edf6c4ac 100644
--- a/astroid/bases.py
+++ b/astroid/bases.py
@@ -289,6 +289,7 @@ class Generator(Instance):
def path_wrapper(func):
"""return the given infer function wrapped to handle the path"""
+ @functools.wraps(func)
def wrapped(node, context=None, _func=func, **kwargs):
"""wrapper function handling context"""
if context is None:
diff --git a/astroid/decorators.py b/astroid/decorators.py
index 2c6e40b7..a446536c 100644
--- a/astroid/decorators.py
+++ b/astroid/decorators.py
@@ -27,14 +27,13 @@ import wrapt
@wrapt.decorator
def cached(func, instance, args, kwargs):
"""Simple decorator to cache result of method calls without args."""
- wrapped_self, = args
- cache = getattr(wrapped_self, '__cache', None)
+ cache = getattr(instance, '__cache', None)
if cache is None:
- wrapped_self.__cache = cache = {}
+ instance.__cache = cache = {}
try:
return cache[func]
except KeyError:
- cache[func] = result = func(wrapped_self)
+ cache[func] = result = func(*args, **kwargs)
return result
--
2.35.1
......@@ -10,6 +10,7 @@ recipe = zc.recipe.egg:custom
egg = astroid
patches =
${:_profile_base_location_}/astroid-six_moves_import_error.patch#377beb0c50f52b9608bb6be7bf93096e
${:_profile_base_location_}/astroid-functools.wraps-needs-to-be-called-with-the-decorate.patch#1e76e79f16af1cf4897ea382146faac4
patch-options = -p1
patch-binary = ${patch:location}/bin/patch
......
......@@ -638,7 +638,7 @@ Zope2 = 2.13.30+SlapOSPatched001
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.4.4+SlapOSPatched002
# astroid 1.4.1 breaks testDynamicClassGeneration
astroid = 1.3.8+SlapOSPatched001
astroid = 1.3.8+SlapOSPatched002
# use newer version than specified in ZTK
PasteDeploy = 1.5.2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment