You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from typing import TypeVar, List, Dict, Any
V = TypeVar("V", List[Any], Dict[Any, Any], float, int, str, bool)
def normalize_keys(value: V) -> V:
if isinstance(value, list):
return [normalize_keys(v) for v in value]
elif isinstance(value, dict):
return {_normalize_key(k): normalize_keys(v) for k, v in value.items()}
else:
return value
def _normalize_key(key: str) -> str:
return key.lower().strip("_").replace(".", "_")
Bug Report
Recursive generic code has broken inference
To Reproduce
MWE in mypy sandbox
Expected Behavior
It should pass as this is valid code.
It passes in mypy 0.971, but reports error in mypy 0.981 and 0.982.
Actual Behavior
Throws error
Your Environment
see the sandbox
The text was updated successfully, but these errors were encountered: