GeezerVison is showing github.com — doc(checker): PEP-484 get_text -> Any · pmhahn/pyenchant@9e46d00
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: enchant/checker/GtkSpellCheckerDialog.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
28 | 28 | # do so, delete this exception statement from your version. |
29 | 29 | # |
30 | 30 |
|
31 | | -from typing import Any, Iterable, List, Optional |
| 31 | +from typing import Any, Iterable, List, cast |
32 | 32 |
|
33 | 33 | import gi |
34 | 34 |
|
@@ -215,7 +215,7 @@ def _getRepl(self) -> str: |
215 | 215 | """Get the chosen replacement string.""" |
216 | 216 | repl = self.replace_text.get_text() |
217 | 217 | repl = self._checker.coerce_string(repl) |
218 | | - return repl |
| 218 | + return cast(str, repl) |
219 | 219 |
|
220 | 220 | def _fillSuggestionList(self, suggestions: Iterable[str]) -> None: |
221 | 221 | model = self.suggestion_list_view.get_model() |
|
Collapse file
Copy file name to clipboardExpand all lines: enchant/checker/__init__.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
47 | 47 |
|
48 | 48 | import array |
49 | 49 | import warnings |
| 50 | +from typing import Any |
50 | 51 | from typing import Dict as PythonDict |
51 | 52 | from typing import List, Optional, Type, Union |
52 | 53 |
|
@@ -202,7 +203,7 @@ def set_text(self, text: Union[bytes, str, array.array]) -> None: |
202 | 203 | raise TypeError(text) |
203 | 204 | self._tokens = self._tokenize(self._text) |
204 | 205 |
|
205 | | - def get_text(self) -> str: |
| 206 | + def get_text(self) -> Any: |
206 | 207 | """Return the spell-checked text.""" |
207 | 208 | if self._use_tostring: |
208 | 209 | return self._array_to_string(self._text) |
|