Python: Expand implicit classmethods

This commit is contained in:
Rasmus Wriedt Larsen
2022-10-12 14:37:15 +02:00
parent 6fefd54533
commit 9949824810

View File

@@ -197,7 +197,11 @@ predicate isClassmethod(Function func) {
or
exists(Class cls |
cls.getAMethod() = func and
func.getName() = "__new__"
func.getName() in [
"__new__", // https://docs.python.org/3.10/reference/datamodel.html#object.__new__
"__init_subclass__", // https://docs.python.org/3.10/reference/datamodel.html#object.__init_subclass__
"__class_getitem__", // https://docs.python.org/3.10/reference/datamodel.html#object.__class_getitem__
]
)
}