diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-08-08 23:48:38 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-08-08 23:48:38 +0300 |
commit | c35df18866e9edb9722ecb1d5641c0608f18a4f7 (patch) | |
tree | 0fde1ea5d95c7c1b463a64bab873ae9995a5a410 /pylint/checkers/utils.py | |
parent | da8f0b3de7c4e877627b6dbb8679c0845567d119 (diff) | |
download | pylint-c35df18866e9edb9722ecb1d5641c0608f18a4f7.tar.gz |
Use the new CallFunc.keywords instead of filtering out Keyword from CallFunc.args.
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r-- | pylint/checkers/utils.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index aff56b0..bc790c5 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -416,15 +416,16 @@ def get_argument_from_call(callfunc_node, position=None, keyword=None): """ if position is None and keyword is None: raise ValueError('Must specify at least one of: position or keyword.') - try: - if position is not None and not isinstance(callfunc_node.args[position], astroid.Keyword): + if position is not None: + try: return callfunc_node.args[position] - except IndexError as error: - raise NoSuchArgumentError(error) - if keyword: - for arg in callfunc_node.args: - if isinstance(arg, astroid.Keyword) and arg.arg == keyword: + except IndexError as error: + pass + if keyword and callfunc_node.keywords: + for arg in callfunc_node.keywords: + if arg.arg == keyword: return arg.value + raise NoSuchArgumentError def inherit_from_std_ex(node): |