Skip to content

Commit 18f7dbe

Browse files
committed
Python: Adjust PEP249 QLDocs
1 parent 249eea9 commit 18f7dbe

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

python/ql/src/semmle/python/frameworks/PEP249.qll

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,35 +62,35 @@ module Connection {
6262
}
6363

6464
/**
65-
* Provides models for the `db.Connection.cursor` method.
65+
* Provides models for the `cursor` method on a connection.
6666
* See https://www.python.org/dev/peps/pep-0249/#cursor.
6767
*/
6868
module cursor {
69-
/** Gets a reference to the `db.connection.cursor` method. */
69+
/** Gets a reference to the `cursor` method on a connection. */
7070
private DataFlow::Node methodRef(DataFlow::TypeTracker t) {
7171
t.startInAttr("cursor") and
7272
result = Connection::instance()
7373
or
7474
exists(DataFlow::TypeTracker t2 | result = methodRef(t2).track(t2, t))
7575
}
7676

77-
/** Gets a reference to the `db.connection.cursor` metod. */
77+
/** Gets a reference to the `cursor` method on a connection. */
7878
DataFlow::Node methodRef() { result = methodRef(DataFlow::TypeTracker::end()) }
7979

80-
/** Gets a reference to a result of calling `db.connection.cursor`. */
80+
/** Gets a reference to a result of calling the `cursor` method on a connection. */
8181
private DataFlow::Node methodResult(DataFlow::TypeTracker t) {
8282
t.start() and
8383
result.asCfgNode().(CallNode).getFunction() = methodRef().asCfgNode()
8484
or
8585
exists(DataFlow::TypeTracker t2 | result = methodResult(t2).track(t2, t))
8686
}
8787

88-
/** Gets a reference to a result of calling `db.connection.cursor`. */
88+
/** Gets a reference to a result of calling the `cursor` method on a connection. */
8989
DataFlow::Node methodResult() { result = methodResult(DataFlow::TypeTracker::end()) }
9090
}
9191

9292
/**
93-
* Gets a reference to the `db.Connection.Cursor.execute` function.
93+
* Gets a reference to the `execute` method on a cursor.
9494
* See https://www.python.org/dev/peps/pep-0249/#id15.
9595
*/
9696
private DataFlow::Node execute(DataFlow::TypeTracker t) {
@@ -101,15 +101,16 @@ private DataFlow::Node execute(DataFlow::TypeTracker t) {
101101
}
102102

103103
/**
104-
* Gets a reference to the `db.Connection.Cursor.execute` function.
104+
* Gets a reference to the `execute` method on a cursor.
105105
* See https://www.python.org/dev/peps/pep-0249/#id15.
106106
*/
107107
DataFlow::Node execute() { result = execute(DataFlow::TypeTracker::end()) }
108108

109-
private class DbConnectionExecute extends SqlExecution::Range, DataFlow::CfgNode {
109+
/** A call to the `execute` method on a cursor. */
110+
private class ExecuteCall extends SqlExecution::Range, DataFlow::CfgNode {
110111
override CallNode node;
111112

112-
DbConnectionExecute() { node.getFunction() = execute().asCfgNode() }
113+
ExecuteCall() { node.getFunction() = execute().asCfgNode() }
113114

114115
override DataFlow::Node getSql() {
115116
result.asCfgNode() in [node.getArg(0), node.getArgByName("sql")]

0 commit comments

Comments
 (0)