Second half of attr_matches.
(self, obj: Any, expr: str, attr: str)
| 437 | return self.attr_lookup(obj, expr, attr) |
| 438 | |
| 439 | def attr_lookup(self, obj: Any, expr: str, attr: str) -> Iterator[str]: |
| 440 | """Second half of attr_matches.""" |
| 441 | words = self.list_attributes(obj) |
| 442 | if inspection.hasattr_safe(obj, "__class__"): |
| 443 | words.append("__class__") |
| 444 | klass = inspection.getattr_safe(obj, "__class__") |
| 445 | words = words + rlcompleter.get_class_members(klass) |
| 446 | if not isinstance(klass, abc.ABCMeta): |
| 447 | try: |
| 448 | words.remove("__abstractmethods__") |
| 449 | except ValueError: |
| 450 | pass |
| 451 | |
| 452 | n = len(attr) |
| 453 | return ( |
| 454 | f"{expr}.{word}" |
| 455 | for word in words |
| 456 | if self.method_match(word, n, attr) and word != "__builtins__" |
| 457 | ) |
| 458 | |
| 459 | def list_attributes(self, obj: Any) -> list[str]: |
| 460 | # TODO: re-implement dir without AttrCleaner here |
no test coverage detected