##// END OF EJS Templates
types hints
M Bussonnier -
Show More
@@ -348,7 +348,7 def provisionalcompleter(action='ignore'):
348 yield
348 yield
349
349
350
350
351 def has_open_quotes(s):
351 def has_open_quotes(s: str) -> Union[str, bool]:
352 """Return whether a string has open quotes.
352 """Return whether a string has open quotes.
353
353
354 This simply counts whether the number of quote characters of either type in
354 This simply counts whether the number of quote characters of either type in
@@ -369,7 +369,7 def has_open_quotes(s):
369 return False
369 return False
370
370
371
371
372 def protect_filename(s, protectables=PROTECTABLES):
372 def protect_filename(s: str, protectables: str = PROTECTABLES) -> str:
373 """Escape a string to protect certain characters."""
373 """Escape a string to protect certain characters."""
374 if set(s) & set(protectables):
374 if set(s) & set(protectables):
375 if sys.platform == "win32":
375 if sys.platform == "win32":
@@ -753,7 +753,7 def completion_matcher(
753 priority: Optional[float] = None,
753 priority: Optional[float] = None,
754 identifier: Optional[str] = None,
754 identifier: Optional[str] = None,
755 api_version: int = 1,
755 api_version: int = 1,
756 ):
756 ) -> Callable[[Matcher], Matcher]:
757 """Adds attributes describing the matcher.
757 """Adds attributes describing the matcher.
758
758
759 Parameters
759 Parameters
@@ -1145,8 +1145,9 class Completer(Configurable):
1145 # we simple attribute matching with normal identifiers.
1145 # we simple attribute matching with normal identifiers.
1146 _ATTR_MATCH_RE = re.compile(r"(.+)\.(\w*)$")
1146 _ATTR_MATCH_RE = re.compile(r"(.+)\.(\w*)$")
1147
1147
1148 def _attr_matches(self, text, include_prefix=True) -> Tuple[Sequence[str], str]:
1148 def _attr_matches(
1149
1149 self, text: str, include_prefix: bool = True
1150 ) -> Tuple[Sequence[str], str]:
1150 m2 = self._ATTR_MATCH_RE.match(self.line_buffer)
1151 m2 = self._ATTR_MATCH_RE.match(self.line_buffer)
1151 if not m2:
1152 if not m2:
1152 return [], ""
1153 return [], ""
@@ -2141,7 +2142,7 class IPCompleter(Completer):
2141 result["suppress"] = is_magic_prefix and bool(result["completions"])
2142 result["suppress"] = is_magic_prefix and bool(result["completions"])
2142 return result
2143 return result
2143
2144
2144 def magic_matches(self, text: str):
2145 def magic_matches(self, text: str) -> List[str]:
2145 """Match magics.
2146 """Match magics.
2146
2147
2147 .. deprecated:: 8.6
2148 .. deprecated:: 8.6
General Comments 0
You need to be logged in to leave comments. Login now