summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 33d90ea3..2cdf5548 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, 2013-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
-# Copyright (c) 2014-2018 Claudiu Popa <pcmanticore@gmail.com>
+# Copyright (c) 2014-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2014 Eevee (Alex Munroe) <amunroe@yelp.com>
# Copyright (c) 2015-2016 Ceridwen <ceridwenv@gmail.com>
@@ -9,9 +9,11 @@
# Copyright (c) 2017-2018 Ashley Whetter <ashley@awhetter.co.uk>
# Copyright (c) 2017 Łukasz Rogalski <rogalski.91@gmail.com>
# Copyright (c) 2017 rr- <rr-@sakuya.pl>
-# Copyright (c) 2018 Bryce Guinta <bryce.paul.guinta@gmail.com>
# Copyright (c) 2018 Nick Drozd <nicholasdrozd@gmail.com>
+# Copyright (c) 2018 Ville Skyttä <ville.skytta@iki.fi>
+# Copyright (c) 2018 Bryce Guinta <bryce.paul.guinta@gmail.com>
# Copyright (c) 2018 HoverHell <hoverhell@gmail.com>
+# Copyright (c) 2019 Hugo van Kemenade <hugovk@users.noreply.github.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
@@ -317,9 +319,14 @@ def _arguments_infer_argname(self, name, context):
if not (self.arguments or self.vararg or self.kwarg):
yield util.Uninferable
return
+
+ functype = self.parent.type
# first argument of instance/class method
- if self.arguments and getattr(self.arguments[0], "name", None) == name:
- functype = self.parent.type
+ if (
+ self.arguments
+ and getattr(self.arguments[0], "name", None) == name
+ and functype != "staticmethod"
+ ):
cls = self.parent.parent.scope()
is_metaclass = isinstance(cls, nodes.ClassDef) and cls.type == "metaclass"
# If this is a metaclass, then the first argument will always
@@ -367,7 +374,7 @@ def arguments_assigned_stmts(self, node=None, context=None, assign_path=None):
callcontext = context.callcontext
context = contextmod.copy_context(context)
context.callcontext = None
- args = arguments.CallSite(callcontext)
+ args = arguments.CallSite(callcontext, context=context)
return args.infer_argument(self.parent, node.name, context)
return _arguments_infer_argname(self, node.name, context)