@@ -477,22 +477,14 @@ def get_object(self, name):
477477 obj = getattr (obj , attributes .pop (0 ))
478478 return obj
479479
480- def get_args (self ):
481- """Check if an unclosed parenthesis exists, then attempt to get the
482- argspec() for it. On success, update self.funcprops,self.arg_pos and
483- return True, otherwise set self.funcprops to None and return False"""
484-
485- self .current_func = None
480+ @classmethod
481+ def _funcname_and_argnum (cls , line ):
482+ """Name of the current function and where we are in args
486483
487- if not self .config .arg_spec :
488- return False
489-
490- # Get the name of the current function and where we are in
491- # the arguments
484+ Returns (None, None) if can't be found."""
492485 stack = [['' , 0 , '' ]]
493486 try :
494- for (token , value ) in PythonLexer ().get_tokens (
495- self .current_line ):
487+ for (token , value ) in PythonLexer ().get_tokens (line ):
496488 if token is Token .Punctuation :
497489 if value in '([{' :
498490 stack .append (['' , 0 , value ])
@@ -522,8 +514,21 @@ def get_args(self):
522514 stack .pop ()
523515 _ , arg_number , _ = stack .pop ()
524516 func , _ , _ = stack .pop ()
517+ return func , arg_number
525518 except IndexError :
519+ return None , None
520+
521+ def get_args (self ):
522+ """Check if an unclosed parenthesis exists, then attempt to get the
523+ argspec() for it. On success, update self.funcprops,self.arg_pos and
524+ return True, otherwise set self.funcprops to None and return False"""
525+
526+ self .current_func = None
527+
528+ if not self .config .arg_spec :
526529 return False
530+
531+ func , arg_number = self ._funcname_and_argnum (self .current_line )
527532 if not func :
528533 return False
529534
0 commit comments