CodeQL library for Python
codeql/python-all 2.1.2-dev (changelog, source)
Search

Class RestFramework::RestFrameworkFunctionBasedViewWithoutKnownRoute

Ensuring that all RestFrameworkFunctionBasedView are also marked as a HTTP::Server::RequestHandler. We only need this for the ones that doesn’t have a known route setup.

Import path

import semmle.python.frameworks.RestFramework

Direct supertypes

Indirect supertypes

Predicates

getARoutedParameter

Gets a parameter that could receive parts of the url when handling incoming requests, if any. These automatically become a RemoteFlowSource.

getFramework

Gets a string that identifies the framework used for this request handler.

Inherited predicates

contains

Whether this contains inner syntactically

from Function
containsInScopefrom Function
getAChildNode

Gets a child node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt().

from Function
getADecorator

Gets a decorator of this function

from Function
getAFlowNode

Gets a flow node corresponding directly to this node. NOTE: For some statements and other purely syntactic elements, there may not be a ControlFlowNode

from AstNode
getAKeywordOnlyArg

Gets a keyword-only parameter of this function.

from Function
getAKwonlyarg

Gets a keyword-only parameter of this function.

from Function_
getANormalExit

Gets an exit from this Scope’s control flow graph, that does not result from an exception

from Scope
getAReturnValueFlowNode

Gets a control flow node for a return value of this function

from Function
getAStmt

Gets a statement in the function

from Function
getATypeParameter

Gets a type parameter of this function.

from Function_
getAnArg

Gets a positional parameter of this function.

from Function_
getAnExitNode

Gets an exit from this Scope’s control flow graph

from Scope
getArg

Gets the nth positional parameter of this function.

from Function_
getArgByName

Gets the parameter of this function with the name name.

from Function
getArgName

Gets the name of the nth argument (for simple arguments)

from Function
getArgs

Gets the positional parameter list of this function.

from Function_
getBody

Gets the statements forming the body of this function

from Function
getDefinition

Gets the expression defining this function

from Function
getDocString

Gets the docstring for this scope

from Scope
getEnclosingModulefrom Scope
getEnclosingScope

Gets the scope in which this function occurs. This will be a class for a method, another function for nested functions, generator expressions or comprehensions, or a module for a plain function.

from Function
getEntryNode

Gets the entry point into this Scope’s control flow graph

from Scope
getEvaluatingScope

Gets the evaluation scope for code in this (lexical) scope. This is usually the scope itself, but may be an enclosing scope. Notably, for list comprehensions in Python 2.

from Function
getFallthroughNode

Gets the non-explicit exit from this Scope’s control flow graph

from Scope
getFirstPossibleRoutedParamIndex

Gets the index of the parameter where the first routed parameter can be passed – that is, the one just after any possible self or HttpRequest parameters.

from DjangoRouteHandler
getFunctionObject

Gets the FunctionObject corresponding to this function

from Function
getKeywordOnlyArg

Gets the nth keyword-only parameter of this function.

from Function
getKeywordOnlyParameterCount

Gets the number of keyword-only parameters

from Function
getKwarg

Gets the dictionary (**) parameter of this function.

from Function_
getKwonlyarg

Gets the nth keyword-only parameter of this function.

from Function_
getKwonlyargs

Gets the keyword-only parameter list of this function.

from Function_
getLastStatementfrom Scope
getLocation

Gets the location for this AST node

from Function
getMetrics

Gets the metrics for this function

from Function
getName

Gets the name used to define this function

from Function
getParent

Gets a parent of this function

from Function_
getParentNode

Gets the parent node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt() applied to the parent.

from AstNode
getPositionalParameterCount

Gets the number of positional parameters

from Function
getQualifiedName

Gets the qualified name for this function. Should return the same name as the __qualname__ attribute on functions in Python 3.

from Function
getRequestParam

Gets the request parameter.

from DjangoRouteHandler
getRequestParamIndex

Gets the index of the request parameter.

from DjangoRouteHandler
getReturnNode

Gets the exit of this scope following from a return statement

from Scope
getScopefrom Function
getStmt

Gets the nth statement in the function

from Function
getTypeParameter

Gets the nth type parameter of this function.

from Function_
getTypeParameters

Gets the type parameters of this function.

from Function_
getVararg

Gets the tuple (*) parameter of this function.

from Function_
hasKwArg

Whether this function accepts arbitrary keyword arguments. That is, whether it has a double-starred (**kwarg) parameter.

from Function
hasVarArg

Whether this function accepts a variable number of arguments. That is, whether it has a starred (*arg) parameter.

from Function
inSource

Holds if this scope is in the source archive, that is it is part of the code specified, not library code

from Scope
isArtificial

Whether this syntactic element is artificial, that is it is generated by the compiler and is not present in the source

from AstNode
isAsync

Whether the async property of this function is true.

from Function_
isGenerator

Whether this function is a generator function, that is whether it contains a yield or yield-from expression

from Function
isInitMethod

Whether this function is declared in a class and is named __init__

from Function
isLambda

Holds if this function represents a lambda.

from Function
isMethod

Whether this function is declared in a class

from Function
isProcedure

Whether this function is a procedure, that is, it has no explicit return statement and always returns None. Note that generator and async functions are not procedures as they return generators and coroutines respectively.

from Function
isPublic

Holds if this scope is deemed to be public

from Scope
isSpecialMethod

Whether this is a special method, that is does its name have the form __xxx__ (except __init__)

from Function
isTopLevel

Holds if this a top-level (non-nested) class or function

from Scope
precedes

Holds if this scope can be expected to execute before other. Modules precede functions and methods in those modules __init__ precedes other methods. __enter__ precedes __exit__. NOTE that this is context-insensitive, so a module “precedes” a function in that module, even if that function is called from the module scope.

from Scope
toStringfrom Function

Charpred