Taken from rlcompleter.py and bent to my will.
(
self, text: str, namespace: dict[str, Any]
)
| 417 | return _after_last_dot(word) |
| 418 | |
| 419 | def attr_matches( |
| 420 | self, text: str, namespace: dict[str, Any] |
| 421 | ) -> Iterator[str]: |
| 422 | """Taken from rlcompleter.py and bent to my will.""" |
| 423 | |
| 424 | m = self.attr_matches_re.match(text) |
| 425 | if not m: |
| 426 | return (_ for _ in ()) |
| 427 | |
| 428 | expr, attr = m.group(1, 3) |
| 429 | if expr.isdigit(): |
| 430 | # Special case: float literal, using attrs here will result in |
| 431 | # a SyntaxError |
| 432 | return (_ for _ in ()) |
| 433 | try: |
| 434 | obj = safe_eval(expr, namespace) |
| 435 | except EvaluationError: |
| 436 | return (_ for _ in ()) |
| 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.""" |
no test coverage detected