Skip to content

Commit 3c8b3f4

Browse files
minor type cleanup
1 parent 64863ef commit 3c8b3f4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

mypy/config_parser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ def _parse_individual_file(
271271
return None
272272

273273
try:
274+
parser: _ParserHelper
274275
if is_toml(config_filename):
275276
with open(config_filename, "rb") as f:
276277
# tomllib.load returns dict[str, Any], so it doesn't complain about any type on the lhs.
@@ -446,7 +447,7 @@ def is_toml(filename: str) -> bool:
446447
return filename.lower().endswith(".toml")
447448

448449

449-
def destructure_overrides(toml_data: _TomlDictDict) -> _ParserHelper:
450+
def destructure_overrides(toml_data: _TomlDictDict) -> _TomlDictDict:
450451
"""Take the new [[tool.mypy.overrides]] section array in the pyproject.toml file,
451452
and convert it back to a flatter structure that the existing config_parser can handle.
452453
@@ -545,7 +546,7 @@ def parse_section(
545546
template: Options,
546547
set_strict_flags: Callable[[], None],
547548
section: Mapping[str, object],
548-
config_types: Mapping[str, object],
549+
config_types: Mapping[str, object], # this is probably dict[str, _INI_PARSER_CALLABLE], but that causes more type errors at the moment.
549550
stderr: TextIO = sys.stderr,
550551
) -> tuple[dict[str, object], dict[str, str]]:
551552
"""Parse one section of a config file.
@@ -620,7 +621,8 @@ def parse_section(
620621
print(f"{prefix}Can not invert non-boolean key {options_key}", file=stderr)
621622
continue
622623
try:
623-
# Why does pyright complain that 0 positional arguments are accepted here?
624+
# pyright complains that 0 positional arguments are accepted here
625+
# (because ct might be type(None) for all it knows)
624626
v = ct(section.get(key))
625627
except VersionTypeError as err_version:
626628
print(f"{prefix}{key}: {err_version}", file=stderr)

0 commit comments

Comments
 (0)