Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30d564c

Browse files
committed
Strict typing for IPython.utils.text
1 parent ddad5ab commit 30d564c

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

IPython/utils/text.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def get_paths(self) -> List[Path]:
102102
# print_lsstring = result_display.register(LSString)(print_lsstring)
103103

104104

105-
class SList(list):
105+
class SList(list[Any]):
106106
"""List derivative with a special access attributes.
107107
108108
These are normal lists, but with the special attributes:
@@ -518,7 +518,7 @@ def vformat(
518518

519519
# do any conversion on the resulting object
520520
# type issue in typeshed, fined in https://github.com/python/typeshed/pull/11377
521-
obj = self.convert_field(obj, conversion) # type: ignore[arg-type]
521+
obj = self.convert_field(obj, conversion)
522522

523523
# format the object and append to the result
524524
result.append(self.format_field(obj, ''))
@@ -550,7 +550,7 @@ class DollarFormatter(FullEvalFormatter):
550550
r"(.*?)\$(\$?[\w\.]+)(?=([^']*'[^']*')*[^']*$)"
551551
)
552552

553-
def parse(self, fmt_string: str) -> Iterator[Tuple[Any, Any, Any, Any]]: # type: ignore[explicit-override]
553+
def parse(self, fmt_string: str) -> Iterator[Tuple[Any, Any, Any, Any]]:
554554
for literal_txt, field_name, format_spec, conversion in Formatter.parse(
555555
self, fmt_string
556556
):

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
129129
[[tool.mypy.overrides]]
130130
module = [
131131
"IPython.core.crashhandler",
132-
"IPython.utils.text",
133132
]
134133
check_untyped_defs = true
135134
disallow_incomplete_defs = true
@@ -165,10 +164,15 @@ ignore_missing_imports = false
165164
[[tool.mypy.overrides]]
166165
module = [
167166
"IPython.core.events",
167+
"IPython.utils.text",
168168
]
169+
check_untyped_defs = true
170+
disallow_incomplete_defs = true
171+
disallow_untyped_calls = true
172+
disallow_untyped_decorators = true
173+
disallow_untyped_defs = true
169174
ignore_errors = false
170175
ignore_missing_imports = false
171-
strict = true
172176

173177
[[tool.mypy.overrides]]
174178
module = [

0 commit comments

Comments
 (0)