Skip to content

Commit b1242e4

Browse files
committed
Pandas.qll: remove unnecessary exists, fix class naming
1 parent fcd2bd6 commit b1242e4

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

python/ql/lib/semmle/python/frameworks/Pandas.qll

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,29 @@ private module Pandas {
102102
*/
103103
class DataFrameMethods extends DataFrame {
104104
DataFrameMethods() {
105-
exists(API::Node dataFrame | dataFrame = any(DataFrame df) |
106-
this =
107-
dataFrame
108-
.getMember([
109-
"copy", "from_records", "from_dict", "from_spmatrix", "assign", "select_dtypes",
110-
"set_flags", "astype", "infer_objects", "head", "xs", "get", "isin", "where",
111-
"mask", "query", "add", "mul", "truediv", "mod", "pow", "dot", "radd", "rsub",
112-
"rdiv", "rfloordiv", "rtruediv", "rpow", "lt", "gt", "le", "ne", "agg",
113-
"combine", "apply", "aggregate", "transform", "all", "any", "clip", "corr",
114-
"cov", "cummax", "cummin", "cumprod", "describe", "mode", "pct_change",
115-
"quantile", "rank", "round", "sem", "add_prefix", "add_suffix", "at_time",
116-
"between_time", "drop", "drop_duplicates", "filter", "first", "head", "idxmin",
117-
"last", "reindex", "reindex_like", "reset_index", "sample", "set_axis", "tail",
118-
"take", "truncate", "bfill", "dropna", "ffill", "fillna", "interpolate", "isna",
119-
"isnull", "notna", "notnull", "pad", "replace", "droplevel", "pivot",
120-
"pivot_table", "reorder_levels", "sort_values", "sort_index", "nlargest",
121-
"nsmallest", "swaplevel", "stack", "unstack", "isnull", "notna", "notnull",
122-
"replace", "droplevel", "pivot", "pivot_table", "reorder_levels", "sort_values",
123-
"sort_index", "nlargest", "nsmallest", "swaplevel", "stack", "unstack", "melt",
124-
"explode", "squeeze", "T", "transpose", "compare", "join", "from_spmatrix",
125-
"shift", "asof", "merge", "from_dict", "tz_convert", "to_period", "asfreq",
126-
"to_dense", "tz_localize", "box", "__dataframe__"
127-
])
128-
.getReturn()
129-
)
105+
this =
106+
any(DataFrame df)
107+
.getMember([
108+
"copy", "from_records", "from_dict", "from_spmatrix", "assign", "select_dtypes",
109+
"set_flags", "astype", "infer_objects", "head", "xs", "get", "isin", "where",
110+
"mask", "query", "add", "mul", "truediv", "mod", "pow", "dot", "radd", "rsub",
111+
"rdiv", "rfloordiv", "rtruediv", "rpow", "lt", "gt", "le", "ne", "agg", "combine",
112+
"apply", "aggregate", "transform", "all", "any", "clip", "corr", "cov", "cummax",
113+
"cummin", "cumprod", "describe", "mode", "pct_change", "quantile", "rank",
114+
"round", "sem", "add_prefix", "add_suffix", "at_time", "between_time", "drop",
115+
"drop_duplicates", "filter", "first", "head", "idxmin", "last", "reindex",
116+
"reindex_like", "reset_index", "sample", "set_axis", "tail", "take", "truncate",
117+
"bfill", "dropna", "ffill", "fillna", "interpolate", "isna", "isnull", "notna",
118+
"notnull", "pad", "replace", "droplevel", "pivot", "pivot_table",
119+
"reorder_levels", "sort_values", "sort_index", "nlargest", "nsmallest",
120+
"swaplevel", "stack", "unstack", "isnull", "notna", "notnull", "replace",
121+
"droplevel", "pivot", "pivot_table", "reorder_levels", "sort_values",
122+
"sort_index", "nlargest", "nsmallest", "swaplevel", "stack", "unstack", "melt",
123+
"explode", "squeeze", "T", "transpose", "compare", "join", "from_spmatrix",
124+
"shift", "asof", "merge", "from_dict", "tz_convert", "to_period", "asfreq",
125+
"to_dense", "tz_localize", "box", "__dataframe__"
126+
])
127+
.getReturn()
130128
}
131129
}
132130
}
@@ -136,8 +134,8 @@ private module Pandas {
136134
* See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html
137135
* https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.eval.html
138136
*/
139-
class DataFlowQueryCall extends CodeExecution::Range, API::CallNode {
140-
DataFlowQueryCall() {
137+
class CodeExecutionCall extends CodeExecution::Range, API::CallNode {
138+
CodeExecutionCall() {
141139
this = any(DataFrame::DataFrame df).getMember(["query", "eval"]).getACall()
142140
}
143141

0 commit comments

Comments
 (0)