Skip to content

Commit 0dcc950

Browse files
committed
fix-failing-tests
1 parent 033e735 commit 0dcc950

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

IPython/core/completer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,13 @@ def _determine_completion_context(self, line):
23832383
# Recursively determine the context of the expression
23842384
return self._determine_completion_context(expr)
23852385

2386+
# Match tuples followed by a dot (e.g., (a, b).index)
2387+
tuple_attr_match = re.search(
2388+
r"\(\s*[a-zA-Z_][a-zA-Z0-9_]*\s*(,\s*[a-zA-Z_][a-zA-Z0-9_]*\s*)+\)\.$", line
2389+
)
2390+
if tuple_attr_match:
2391+
return self._CompletionContextType.ATTRIBUTE
2392+
23862393
# Match for number literals should come first
23872394
# Handle plain number literals - should be global context
23882395
if re.search(r"^[-+]?\d+\.(\d+)?$", line):
@@ -2391,7 +2398,7 @@ def _determine_completion_context(self, line):
23912398
# Match numeric literals in parentheses followed by dot
23922399
# Handles cases like (3).to_
23932400
numeric_paren_attr_match = re.search(
2394-
r"\([-+]?\d+(\.\d*)?\)\.([a-zA-Z_][a-zA-Z0-9_]*)?$", line
2401+
r"\([-+]?\d+(\.\d*)?\)(\.([a-zA-Z_][a-zA-Z0-9_]*)?)?$", line
23952402
)
23962403
if numeric_paren_attr_match:
23972404
return self._CompletionContextType.ATTRIBUTE

0 commit comments

Comments
 (0)