-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
astral-sh/ruff
#20814Labels
bugSomething isn't workingSomething isn't workingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Description
Summary
ty errors saying the annotation of the cls as type[Any] for a class inheriting from type, in the init, is wrong.
We're getting
error[invalid-super-argument]: `type[Any]` is not an instance or subclass of `<class 'BuilderMeta'>` in `super(<class 'BuilderMeta'>, type[Any])` call
|
453 | dct["use_legacy"] = define_builder_use_legacy()
454 | dct["dict"] = define_builder_dict()
455 | instance = super().__new__(cls, name, bases, dct)
| ^^^^^^^
456 | instance.__field_names__ = field_names
457 | instance.from_behave_context = define_builder_from_behave_context(instance)
|
info: rule `invalid-super-argument` is enabled by default
Which points to the following code
class BuilderMeta(type):
def __new__(
cls: type[Any],
name: str,
bases: tuple[type, ...],
dct: dict[str, Any],
) -> "BuilderMeta":
instance = super().__new__(cls, name, bases, dct)
Works without issues with mypy 1.17.1, with this config:
allow_subclassing_any=true
allow_untyped_decorators=true
ignore_missing_imports = true
no_warn_return_any=true
strict=true
Version
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc