directives_cast error

Invalid cast() call

typing.cast(typ, val) must be called with exactly two positional arguments, and the first argument must be a type expression, not a value literal.

- cast() — too few arguments - cast(1, x) — first argument is a literal, not a type - cast(int, x, y) — too many arguments

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial directives_cast down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/directives_cast