@@ -248,7 +248,7 @@ def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None):
248248 def token_not_matching (self , funcs , idx ):
249249 funcs = (funcs ,) if not isinstance (funcs , (list , tuple )) else funcs
250250 funcs = [lambda tk : not func (tk ) for func in funcs ]
251- return self ._token_matching (funcs , idx )[ 1 ]
251+ return self ._token_matching (funcs , idx )
252252
253253 def token_matching (self , funcs , idx ):
254254 return self ._token_matching (funcs , idx )[1 ]
@@ -297,13 +297,9 @@ def token_index(self, token, start=0):
297297 def group_tokens (self , grp_cls , start , end , include_end = True ,
298298 extend = False ):
299299 """Replace tokens by an instance of *grp_cls*."""
300- if isinstance (start , int ):
301- start_idx = start
302- start = self .tokens [start_idx ]
303- else :
304- start_idx = self .token_index (start )
300+ start_idx = start
301+ start = self .tokens [start_idx ]
305302
306- end = end if isinstance (end , int ) else self .token_index (end , start_idx )
307303 end_idx = end + include_end
308304
309305 # will be needed later for new group_clauses
@@ -390,9 +386,6 @@ def get_parent_name(self):
390386 def _get_first_name (self , idx = None , reverse = False , keywords = False ):
391387 """Returns the name of the first token with a name"""
392388
393- if idx and not isinstance (idx , int ):
394- idx = self .token_index (idx ) + 1
395-
396389 tokens = self .tokens [idx :] if idx else self .tokens
397390 tokens = reversed (tokens ) if reverse else tokens
398391 types = [T .Name , T .Wildcard , T .String .Symbol ]
0 commit comments