[tool.mypy]
strict = true
-
-[[tool.mypy.overrides]]
-module = "sqlmodel.sql._expression_select_gen"
-warn_unused_ignores = false
+exclude = "sqlmodel.sql._expression_select_gen"
[[tool.mypy.overrides]]
module = "docs_src.*"
-r requirements-docs-tests.txt
pytest >=7.0.1,<9.0.0
coverage[toml] >=6.2,<8.0
-mypy ==1.4.1
+# Remove when support for Python 3.8 is dropped
+mypy ==1.14.1; python_version < "3.9"
+mypy ==1.18.2; python_version >= "3.9"
ruff ==0.13.2
# For FastAPI tests
fastapi >=0.103.2
object.__setattr__(new_object, "__pydantic_private__", None)
def get_annotations(class_dict: Dict[str, Any]) -> Dict[str, Any]:
- return class_dict.get("__annotations__", {})
+ return class_dict.get("__annotations__", {}) # type: ignore[no-any-return]
def is_table_model_class(cls: Type[Any]) -> bool:
config = getattr(cls, "model_config", {})
if not field.is_required():
if field.default is Undefined:
return False
- if field.annotation is None or field.annotation is NoneType: # type: ignore[comparison-overlap]
+ if field.annotation is None or field.annotation is NoneType:
return True
return False
return False
keys -= update.keys()
if exclude:
- keys -= {k for k, v in exclude.items() if ValueItems.is_true(v)}
+ keys -= {str(k) for k, v in exclude.items() if ValueItems.is_true(v)}
return keys
+from __future__ import annotations
+
import ipaddress
import uuid
import weakref
setattr(cls, rel_name, rel_info.sa_relationship) # Fix #315
continue
raw_ann = cls.__annotations__[rel_name]
- origin = get_origin(raw_ann)
+ origin: Any = get_origin(raw_ann)
if origin is Mapped:
ann = raw_ann.__args__[0]
else: