Skip to content

Commit f44b8c2

Browse files
committed
Refactor
1 parent 748ce36 commit f44b8c2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

bpython/autocomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def matches(
598598
if isinstance(name, str) and name.startswith(r.word)
599599
}
600600
matches.update(
601-
name + "="
601+
f"{name}="
602602
for name in funcprops.argspec.kwonly
603603
if name.startswith(r.word)
604604
)

bpython/inspection.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ def parsekeywordpairs(signature: str) -> Dict[str, str]:
142142
parendepth += 1
143143
elif value in ")}]":
144144
parendepth -= 1
145-
elif value == ":" and parendepth == -1:
146-
# End of signature reached
147-
break
148-
elif value == ":" and parendepth == 0:
149-
# Start of type annotation
150-
annotation = True
151-
152-
if (value == "," and parendepth == 0) or (
153-
value == ")" and parendepth == -1
154-
):
145+
elif value == ":":
146+
if parendepth == -1:
147+
# End of signature reached
148+
break
149+
elif parendepth == 0:
150+
# Start of type annotation
151+
annotation = True
152+
153+
if (value, parendepth) in ((",", 0), (")", -1)):
154+
# End of current argument
155155
stack.append(substack)
156156
substack = []
157157
# If type annotation didn't end before, it does now.

0 commit comments

Comments
 (0)