File tree Expand file tree Collapse file tree 7 files changed +20
-16
lines changed
python/ql/lib/semmle/python/frameworks Expand file tree Collapse file tree 7 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,9 @@ module AiohttpWebModel {
243
243
244
244
/** A class that has a super-type which is an aiohttp.web View class. */
245
245
class AiohttpViewClassFromSuperClass extends AiohttpViewClass {
246
- AiohttpViewClassFromSuperClass ( ) { this .getABase ( ) = View:: subclassRef ( ) .getAUse ( ) .asExpr ( ) }
246
+ AiohttpViewClassFromSuperClass ( ) {
247
+ this .getParent ( ) = View:: subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( )
248
+ }
247
249
}
248
250
249
251
/** A class that is used in a route-setup, therefore being considered an aiohttp.web View class. */
Original file line number Diff line number Diff line change @@ -829,7 +829,7 @@ module PrivateDjango {
829
829
830
830
/** Gets the (AST) class of the Django model class `modelClass`. */
831
831
Class getModelClassClass ( API:: Node modelClass ) {
832
- result .getParent ( ) = modelClass .getAUse ( ) .asExpr ( ) . ( ClassExpr ) and
832
+ result .getParent ( ) = modelClass .getAnImmediateUse ( ) .asExpr ( ) and
833
833
modelClass = Model:: subclassRef ( )
834
834
}
835
835
@@ -2162,7 +2162,9 @@ module PrivateDjango {
2162
2162
* thereby handling user input.
2163
2163
*/
2164
2164
class DjangoFormClass extends Class , SelfRefMixin {
2165
- DjangoFormClass ( ) { this .getABase ( ) = Django:: Forms:: Form:: subclassRef ( ) .getAUse ( ) .asExpr ( ) }
2165
+ DjangoFormClass ( ) {
2166
+ this .getParent ( ) = Django:: Forms:: Form:: subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( )
2167
+ }
2166
2168
}
2167
2169
2168
2170
/**
@@ -2195,7 +2197,7 @@ module PrivateDjango {
2195
2197
*/
2196
2198
class DjangoFormFieldClass extends Class {
2197
2199
DjangoFormFieldClass ( ) {
2198
- this .getABase ( ) = Django:: Forms:: Field:: subclassRef ( ) .getAUse ( ) .asExpr ( )
2200
+ this .getParent ( ) = Django:: Forms:: Field:: subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( )
2199
2201
}
2200
2202
}
2201
2203
@@ -2298,7 +2300,7 @@ module PrivateDjango {
2298
2300
*/
2299
2301
class DjangoViewClassFromSuperClass extends DjangoViewClass {
2300
2302
DjangoViewClassFromSuperClass ( ) {
2301
- this .getABase ( ) = Django:: Views:: View:: subclassRef ( ) .getAUse ( ) .asExpr ( )
2303
+ this .getParent ( ) = Django:: Views:: View:: subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( )
2302
2304
}
2303
2305
}
2304
2306
Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ module Flask {
194
194
API:: Node api_node ;
195
195
196
196
FlaskViewClass ( ) {
197
- this . getABase ( ) = Views:: View:: subclassRef ( ) . getAUse ( ) . asExpr ( ) and
198
- api_node . getAnImmediateUse ( ) . asExpr ( ) = this . getParent ( )
197
+ api_node = Views:: View:: subclassRef ( ) and
198
+ this . getParent ( ) = api_node . getAnImmediateUse ( ) . asExpr ( )
199
199
}
200
200
201
201
/** Gets a function that could handle incoming requests, if any. */
@@ -219,8 +219,8 @@ module Flask {
219
219
*/
220
220
class FlaskMethodViewClass extends FlaskViewClass {
221
221
FlaskMethodViewClass ( ) {
222
- this . getABase ( ) = Views:: MethodView:: subclassRef ( ) . getAUse ( ) . asExpr ( ) and
223
- api_node . getAnImmediateUse ( ) . asExpr ( ) = this . getParent ( )
222
+ api_node = Views:: MethodView:: subclassRef ( ) and
223
+ this . getParent ( ) = api_node . getAnImmediateUse ( ) . asExpr ( )
224
224
}
225
225
226
226
override Function getARequestHandler ( ) {
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ private module RestFramework {
115
115
*/
116
116
class RestFrameworkApiViewClass extends PrivateDjango:: DjangoViewClassFromSuperClass {
117
117
RestFrameworkApiViewClass ( ) {
118
- this .getABase ( ) = any ( ModeledApiViewClasses c ) .getASubclass * ( ) .getAUse ( ) .asExpr ( )
118
+ this .getParent ( ) = any ( ModeledApiViewClasses c ) .getASubclass * ( ) .getAnImmediateUse ( ) .asExpr ( )
119
119
}
120
120
121
121
override Function getARequestHandler ( ) {
Original file line number Diff line number Diff line change @@ -1934,7 +1934,7 @@ private module StdlibPrivate {
1934
1934
1935
1935
/** A HttpRequestHandler class definition (most likely in project code). */
1936
1936
class HttpRequestHandlerClassDef extends Class {
1937
- HttpRequestHandlerClassDef ( ) { this .getParent ( ) = subclassRef ( ) .getAUse ( ) .asExpr ( ) }
1937
+ HttpRequestHandlerClassDef ( ) { this .getParent ( ) = subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( ) }
1938
1938
}
1939
1939
1940
1940
/** DEPRECATED: Alias for HttpRequestHandlerClassDef */
@@ -2027,12 +2027,12 @@ private module StdlibPrivate {
2027
2027
private module WsgirefSimpleServer {
2028
2028
class WsgiServerSubclass extends Class , SelfRefMixin {
2029
2029
WsgiServerSubclass ( ) {
2030
- this .getABase ( ) =
2030
+ this .getParent ( ) =
2031
2031
API:: moduleImport ( "wsgiref" )
2032
2032
.getMember ( "simple_server" )
2033
2033
.getMember ( "WSGIServer" )
2034
2034
.getASubclass * ( )
2035
- .getAUse ( )
2035
+ .getAnImmediateUse ( )
2036
2036
.asExpr ( )
2037
2037
}
2038
2038
}
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ private module Tornado {
92
92
93
93
/** A RequestHandler class (most likely in project code). */
94
94
class RequestHandlerClass extends Class {
95
- RequestHandlerClass ( ) { this .getParent ( ) = subclassRef ( ) .getAUse ( ) .asExpr ( ) }
95
+ RequestHandlerClass ( ) { this .getParent ( ) = subclassRef ( ) .getAnImmediateUse ( ) .asExpr ( ) }
96
96
97
97
/** Gets a function that could handle incoming requests, if any. */
98
98
Function getARequestHandler ( ) {
Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ private module Twisted {
27
27
*/
28
28
class TwistedResourceSubclass extends Class {
29
29
TwistedResourceSubclass ( ) {
30
- this .getABase ( ) =
30
+ this .getParent ( ) =
31
31
API:: moduleImport ( "twisted" )
32
32
.getMember ( "web" )
33
33
.getMember ( "resource" )
34
34
.getMember ( "Resource" )
35
35
.getASubclass * ( )
36
- .getAUse ( )
36
+ .getAnImmediateUse ( )
37
37
.asExpr ( )
38
38
}
39
39
You can’t perform that action at this time.
0 commit comments