Skip to content

Commit 1078df7

Browse files
committed
types hints
1 parent ce148f2 commit 1078df7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

IPython/core/completer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def provisionalcompleter(action='ignore'):
348348
yield
349349

350350

351-
def has_open_quotes(s):
351+
def has_open_quotes(s: str) -> Union[str, bool]:
352352
"""Return whether a string has open quotes.
353353
354354
This simply counts whether the number of quote characters of either type in
@@ -369,7 +369,7 @@ def has_open_quotes(s):
369369
return False
370370

371371

372-
def protect_filename(s, protectables=PROTECTABLES):
372+
def protect_filename(s: str, protectables: str = PROTECTABLES) -> str:
373373
"""Escape a string to protect certain characters."""
374374
if set(s) & set(protectables):
375375
if sys.platform == "win32":
@@ -753,7 +753,7 @@ def completion_matcher(
753753
priority: Optional[float] = None,
754754
identifier: Optional[str] = None,
755755
api_version: int = 1,
756-
):
756+
) -> Callable[[Matcher], Matcher]:
757757
"""Adds attributes describing the matcher.
758758
759759
Parameters
@@ -1145,8 +1145,9 @@ def attr_matches(self, text):
11451145
# we simple attribute matching with normal identifiers.
11461146
_ATTR_MATCH_RE = re.compile(r"(.+)\.(\w*)$")
11471147

1148-
def _attr_matches(self, text, include_prefix=True) -> Tuple[Sequence[str], str]:
1149-
1148+
def _attr_matches(
1149+
self, text: str, include_prefix: bool = True
1150+
) -> Tuple[Sequence[str], str]:
11501151
m2 = self._ATTR_MATCH_RE.match(self.line_buffer)
11511152
if not m2:
11521153
return [], ""
@@ -2141,7 +2142,7 @@ def magic_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
21412142
result["suppress"] = is_magic_prefix and bool(result["completions"])
21422143
return result
21432144

2144-
def magic_matches(self, text: str):
2145+
def magic_matches(self, text: str) -> List[str]:
21452146
"""Match magics.
21462147
21472148
.. deprecated:: 8.6

0 commit comments

Comments
 (0)