(cls: Type[Any], base: Type[Any])
| 979 | |
| 980 | |
| 981 | def _check_not_declarative(cls: Type[Any], base: Type[Any]) -> None: |
| 982 | cls_dict = cls.__dict__ |
| 983 | if ( |
| 984 | "__table__" in cls_dict |
| 985 | and not ( |
| 986 | callable(cls_dict["__table__"]) |
| 987 | or hasattr(cls_dict["__table__"], "__get__") |
| 988 | ) |
| 989 | ) or isinstance(cls_dict.get("__tablename__", None), str): |
| 990 | raise exc.InvalidRequestError( |
| 991 | f"Cannot use {base.__name__!r} directly as a declarative base " |
| 992 | "class. Create a Base by creating a subclass of it." |
| 993 | ) |
| 994 | |
| 995 | |
| 996 | class DeclarativeBaseNoMeta( |
no test coverage detected