Skip to content

Commit 92a7114

Browse files
committed
Python: Add API references
1 parent c6d285d commit 92a7114

File tree

1 file changed

+27
-6
lines changed
  • python/ql/lib/semmle/python/frameworks

1 file changed

+27
-6
lines changed

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

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ private import semmle.python.ApiGraphs
1414
private module Aiopg {
1515
private import semmle.python.internal.Awaited
1616

17-
/** A `ConectionPool` is created when the result of `aiopg.create_pool()` is awaited. */
17+
/**
18+
* A `ConectionPool` is created when the result of `aiopg.create_pool()` is awaited.
19+
* See https://aiopg.readthedocs.io/en/stable/core.html#pool
20+
*/
1821
API::Node connectionPool() {
1922
result = API::moduleImport("aiopg").getMember("create_pool").getReturn().getAwaited()
2023
}
@@ -23,6 +26,7 @@ private module Aiopg {
2326
* A `Connection` is created when
2427
* - the result of `aiopg.connect()` is awaited.
2528
* - the result of calling `aquire` on a `ConnectionPool` is awaited.
29+
* See https://aiopg.readthedocs.io/en/stable/core.html#connection
2630
*/
2731
API::Node connection() {
2832
result = API::moduleImport("aiopg").getMember("connect").getReturn().getAwaited()
@@ -34,14 +38,18 @@ private module Aiopg {
3438
* A `Cursor` is created when
3539
* - the result of calling `cursor` on a `ConnectionPool` is awaited.
3640
* - the result of calling `cursor` on a `Connection` is awaited.
41+
* See https://aiopg.readthedocs.io/en/stable/core.html#cursor
3742
*/
3843
API::Node cursor() {
3944
result = connectionPool().getMember("cursor").getReturn().getAwaited()
4045
or
4146
result = connection().getMember("cursor").getReturn().getAwaited()
4247
}
4348

44-
/** Calling `execute` on a `Cursor` constructs a query. */
49+
/**
50+
* Calling `execute` on a `Cursor` constructs a query.
51+
* See https://aiopg.readthedocs.io/en/stable/core.html#aiopg.Cursor.execute
52+
*/
4553
class CursorExecuteCall extends SqlConstruction::Range, DataFlow::CallCfgNode {
4654
CursorExecuteCall() { this = cursor().getMember("execute").getACall() }
4755

@@ -64,7 +72,10 @@ private module Aiopg {
6472
cursorExecuteCall(DataFlow::TypeTracker::end(), sql).flowsTo(result)
6573
}
6674

67-
/** Awaiting the result of calling `execute` executes the query. */
75+
/**
76+
* Awaiting the result of calling `execute` executes the query.
77+
* See https://aiopg.readthedocs.io/en/stable/core.html#aiopg.Cursor.execute
78+
*/
6879
class AwaitedCursorExecuteCall extends SqlExecution::Range {
6980
DataFlow::Node sql;
7081

@@ -73,18 +84,25 @@ private module Aiopg {
7384
override DataFlow::Node getSql() { result = sql }
7485
}
7586

76-
/** An `Engine` is created when the result of calling `aiopg.sa.create_engine` is awaited. */
87+
/**
88+
* An `Engine` is created when the result of calling `aiopg.sa.create_engine` is awaited.
89+
* See https://aiopg.readthedocs.io/en/stable/sa.html#engine
90+
*/
7791
API::Node engine() {
7892
result =
7993
API::moduleImport("aiopg").getMember("sa").getMember("create_engine").getReturn().getAwaited()
8094
}
8195

8296
/**
8397
* A `SAConnection` is created when the result of calling `aquire` on an `Engine` is awaited.
98+
* See https://aiopg.readthedocs.io/en/stable/sa.html#connection
8499
*/
85100
API::Node saConnection() { result = engine().getMember("acquire").getReturn().getAwaited() }
86101

87-
/** Calling `execute` on a `SAConnection` constructs a query. */
102+
/**
103+
* Calling `execute` on a `SAConnection` constructs a query.
104+
* See https://aiopg.readthedocs.io/en/stable/sa.html#aiopg.sa.SAConnection.execute
105+
*/
88106
class SAConnectionExecuteCall extends SqlConstruction::Range, DataFlow::CallCfgNode {
89107
SAConnectionExecuteCall() { this = saConnection().getMember("execute").getACall() }
90108

@@ -109,7 +127,10 @@ private module Aiopg {
109127
saConnectionExecuteCall(DataFlow::TypeTracker::end(), sql).flowsTo(result)
110128
}
111129

112-
/** Awaiting the result of calling `execute` executes the query. */
130+
/**
131+
* Awaiting the result of calling `execute` executes the query.
132+
* See https://aiopg.readthedocs.io/en/stable/sa.html#aiopg.sa.SAConnection.execute
133+
*/
113134
class AwaitedSAConnectionExecuteCall extends SqlExecution::Range {
114135
DataFlow::Node sql;
115136

0 commit comments

Comments
 (0)