mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: Modernise the py/not-named-cls query.
This commit is contained in:
@@ -23,13 +23,13 @@ predicate first_arg_cls(Function f) {
|
||||
}
|
||||
|
||||
predicate is_type_method(Function f) {
|
||||
exists(ClassObject c | c.getPyClass() = f.getScope() and c.getASuperType() = theTypeType())
|
||||
exists(ClassValue c | c.getScope() = f.getScope() and c.getASuperType() = ClassValue::type())
|
||||
}
|
||||
|
||||
predicate classmethod_decorators_only(Function f) {
|
||||
forall(Expr decorator |
|
||||
decorator = f.getADecorator() |
|
||||
((Name) decorator).getId() = "classmethod")
|
||||
decorator.(Name).getId() = "classmethod")
|
||||
}
|
||||
|
||||
from Function f, string message
|
||||
|
||||
@@ -560,6 +560,11 @@ module ClassValue {
|
||||
result = TBuiltinClassObject(Builtin::special("FunctionType"))
|
||||
}
|
||||
|
||||
/** Get the `ClassValue` for the `type` class. */
|
||||
ClassValue type() {
|
||||
result = TType()
|
||||
}
|
||||
|
||||
/** Get the `ClassValue` for the class of builtin functions. */
|
||||
ClassValue builtinFunction() {
|
||||
result = Value::named("len").getClass()
|
||||
|
||||
Reference in New Issue
Block a user