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/strings.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/strings.py')
-rw-r--r-- | pylint/checkers/strings.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py index 305ab54..528aa5d 100644 --- a/pylint/checkers/strings.py +++ b/pylint/checkers/strings.py @@ -199,19 +199,18 @@ def parse_format_method_string(format_string): return keys, num_args, len(manual_pos_arg) def get_args(callfunc): - """ Get the arguments from the given `CallFunc` node. + """Get the arguments from the given `CallFunc` node. + Return a tuple, where the first element is the number of positional arguments and the second element is the keyword arguments in a dict. """ - positional = 0 - named = {} - - for arg in callfunc.args: - if isinstance(arg, astroid.Keyword): - named[arg.arg] = helpers.safe_infer(arg.value) - else: - positional += 1 + if callfunc.keywords: + named = {arg.arg: helpers.safe_infer(arg.value) + for arg in callfunc.keywords} + else: + named = {} + positional = len(callfunc.args) return positional, named def get_access_path(key, parts): |