File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
python/ql/lib/semmle/python/dataflow/new/internal Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2158,6 +2158,23 @@ module DuckTyping {
21582158 or
21592159 f .getADecorator ( ) .( Name ) .getId ( ) = "property"
21602160 }
2161+
2162+ /** Gets the name of the builtin class of the immutable literal `lit`. */
2163+ string getClassName ( ImmutableLiteral lit ) {
2164+ lit instanceof IntegerLiteral and result = "int"
2165+ or
2166+ lit instanceof FloatLiteral and result = "float"
2167+ or
2168+ lit instanceof ImaginaryLiteral and result = "complex"
2169+ or
2170+ lit instanceof NegativeIntegerLiteral and result = "int"
2171+ or
2172+ lit instanceof StringLiteral and result = "str"
2173+ or
2174+ lit instanceof BooleanLiteral and result = "bool"
2175+ or
2176+ lit instanceof None and result = "NoneType"
2177+ }
21612178}
21622179
21632180/**
You can’t perform that action at this time.
0 commit comments