Return a slice in StmtClassDef#bases (#6311)

Slices are strictly more flexible, since you can always convert to an
iterator, etc., but not the other way around. Suggested in
https://github.com/astral-sh/ruff/pull/6259#discussion_r1282730994.
This commit is contained in:
Charlie Marsh 2023-08-03 12:21:55 -04:00 committed by GitHub
parent 718e3945e3
commit 2fa508793f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 15 deletions

View file

@ -42,7 +42,7 @@ pub fn classify(
FunctionType::StaticMethod
} else if matches!(name, "__new__" | "__init_subclass__" | "__class_getitem__")
// Special-case class method, like `__new__`.
|| class_def.bases().any(|expr| {
|| class_def.bases().iter().any(|expr| {
// The class itself extends a known metaclass, so all methods are class methods.
semantic
.resolve_call_path(map_callable(expr))