@@ -418,25 +418,27 @@ def locate(self, cursor_offset: int, line: str) -> Optional[LinePart]:
418418def format (self ,word :str )-> str :
419419return _after_last_dot (word )
420420
421- def attr_matches (self ,text :str ,namespace :Dict [str ,Any ])-> List :
421+ def attr_matches (
422+ self ,text :str ,namespace :Dict [str ,Any ]
423+ )-> Iterator [str ]:
422424"""Taken from rlcompleter.py and bent to my will."""
423425
424426m = self .attr_matches_re .match (text )
425427if not m :
426- return []
428+ return ( _ for _ in ())
427429
428430expr ,attr = m .group (1 ,3 )
429431if expr .isdigit ():
430432# Special case: float literal, using attrs here will result in
431433# a SyntaxError
432- return []
434+ return ( _ for _ in ())
433435try :
434436obj = safe_eval (expr ,namespace )
435437except EvaluationError :
436- return []
438+ return ( _ for _ in ())
437439return self .attr_lookup (obj ,expr ,attr )
438440
439- def attr_lookup (self ,obj :Any ,expr :str ,attr :str )-> List :
441+ def attr_lookup (self ,obj :Any ,expr :str ,attr :str )-> Iterator [ str ] :
440442"""Second half of attr_matches."""
441443words = self .list_attributes (obj )
442444if inspection .hasattr_safe (obj ,"__class__" ):
@@ -449,12 +451,12 @@ def attr_lookup(self, obj: Any, expr: str, attr: str) -> List:
449451except ValueError :
450452pass
451453
452- matches = []
453454n = len (attr )
454- for word in words :
455- if self .method_match (word ,n ,attr )and word != "__builtins__" :
456- matches .append (f"{ expr } .{ word } " )
457- return matches
455+ return (
456+ f"{ expr } .{ word } "
457+ for word in words
458+ if self .method_match (word ,n ,attr )and word != "__builtins__"
459+ )
458460
459461def list_attributes (self ,obj :Any )-> List [str ]:
460462# TODO: re-implement dir without AttrCleaner here