@@ -64,15 +64,6 @@ predicate subscript(Stmt s) {
64
64
s .( Delete ) .getATarget ( ) instanceof Subscript
65
65
}
66
66
67
- predicate encode_decode_objectapi ( Expr ex , ClassObject type ) {
68
- exists ( string name |
69
- ex .( Call ) .getFunc ( ) .( Attribute ) .getName ( ) = name |
70
- name = "encode" and type = Object:: builtin ( "UnicodeEncodeError" )
71
- or
72
- name = "decode" and type = Object:: builtin ( "UnicodeDecodeError" )
73
- )
74
- }
75
-
76
67
predicate encode_decode ( Expr ex , ClassValue type ) {
77
68
exists ( string name |
78
69
ex .( Call ) .getFunc ( ) .( Attribute ) .getName ( ) = name |
@@ -82,34 +73,12 @@ predicate encode_decode(Expr ex, ClassValue type) {
82
73
)
83
74
}
84
75
85
- predicate small_handler_objectapi ( ExceptStmt ex , Stmt s , ClassObject type ) {
86
- not exists ( ex .getTry ( ) .getStmt ( 1 ) ) and
87
- s = ex .getTry ( ) .getStmt ( 0 ) and
88
- ex .getType ( ) .refersTo ( type )
89
- }
90
-
91
76
predicate small_handler ( ExceptStmt ex , Stmt s , ClassValue type ) {
92
77
not exists ( ex .getTry ( ) .getStmt ( 1 ) ) and
93
78
s = ex .getTry ( ) .getStmt ( 0 ) and
94
79
ex .getType ( ) .pointsTo ( type )
95
80
}
96
81
97
- /** Holds if this exception handler is sufficiently small in scope to not need a comment
98
- * as to what it is doing.
99
- */
100
- predicate focussed_handler_objectapi ( ExceptStmt ex ) {
101
- exists ( Stmt s , ClassObject type |
102
- small_handler_objectapi ( ex , s , type ) |
103
- subscript ( s ) and type .getAnImproperSuperType ( ) = theLookupErrorType ( )
104
- or
105
- attribute_access ( s ) and type = theAttributeErrorType ( )
106
- or
107
- s .( ExprStmt ) .getValue ( ) instanceof Name and type = theNameErrorType ( )
108
- or
109
- encode_decode_objectapi ( s .( ExprStmt ) .getValue ( ) , type )
110
- )
111
- }
112
-
113
82
predicate focussed_handler ( ExceptStmt ex ) {
114
83
exists ( Stmt s , ClassValue type |
115
84
small_handler ( ex , s , type ) |
0 commit comments