mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-133117: Run mypy on tomllib
in CI (#133118)
This commit is contained in:
parent
fd0f5d0a5e
commit
5ea9010e89
5 changed files with 25 additions and 2 deletions
2
.github/workflows/mypy.yml
vendored
2
.github/workflows/mypy.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
|||
- "Lib/_colorize.py"
|
||||
- "Lib/_pyrepl/**"
|
||||
- "Lib/test/libregrtest/**"
|
||||
- "Lib/tomllib/**"
|
||||
- "Misc/mypy/**"
|
||||
- "Tools/build/generate_sbom.py"
|
||||
- "Tools/cases_generator/**"
|
||||
|
@ -44,6 +45,7 @@ jobs:
|
|||
target: [
|
||||
"Lib/_pyrepl",
|
||||
"Lib/test/libregrtest",
|
||||
"Lib/tomllib",
|
||||
"Tools/build",
|
||||
"Tools/cases_generator",
|
||||
"Tools/clinic",
|
||||
|
|
|
@ -282,7 +282,7 @@ class NestedDict:
|
|||
cont = cont[-1]
|
||||
if not isinstance(cont, dict):
|
||||
raise KeyError("There is no nest behind this key")
|
||||
return cont
|
||||
return cont # type: ignore[no-any-return]
|
||||
|
||||
def append_nest_to_list(self, key: Key) -> None:
|
||||
cont = self.get_or_create_nest(key[:-1])
|
||||
|
@ -741,7 +741,7 @@ def make_safe_parse_float(parse_float: ParseFloat) -> ParseFloat:
|
|||
instead of returning illegal types.
|
||||
"""
|
||||
# The default `float` callable never returns illegal types. Optimize it.
|
||||
if parse_float is float: # type: ignore[comparison-overlap]
|
||||
if parse_float is float:
|
||||
return float
|
||||
|
||||
def safe_parse_float(float_str: str) -> Any:
|
||||
|
|
19
Lib/tomllib/mypy.ini
Normal file
19
Lib/tomllib/mypy.ini
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Config file for running mypy on tomllib.
|
||||
# Run mypy by invoking `mypy --config-file Lib/tomllib/mypy.ini`
|
||||
# on the command-line from the repo root
|
||||
|
||||
[mypy]
|
||||
files = Lib/tomllib
|
||||
mypy_path = $MYPY_CONFIG_FILE_DIR/../../Misc/mypy
|
||||
explicit_package_bases = True
|
||||
python_version = 3.12
|
||||
pretty = True
|
||||
|
||||
# Enable most stricter settings
|
||||
enable_error_code = ignore-without-code
|
||||
strict = True
|
||||
strict_bytes = True
|
||||
local_partial_types = True
|
||||
warn_unreachable = True
|
||||
# TODO(@sobolevn): remove this setting and refactor any found problems
|
||||
disallow_any_generics = False
|
1
Misc/mypy/tomllib
Symbolic link
1
Misc/mypy/tomllib
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../Lib/tomllib
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
_colorize.py
|
||||
_pyrepl
|
||||
tomllib
|
Loading…
Add table
Add a link
Reference in a new issue