Skip to content

Commit ed2cb73

Browse files
authored
Merge pull request github#5486 from yoff/python-document-api-import-node
Python, doc: Note ephemeral nature of import nodes
2 parents 90868a4 + 32b264b commit ed2cb73

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/codeql/codeql-language-guides/using-api-graphs-in-python.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ following snippet demonstrates.
3131
3232
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/1876172022264324639/>`__.
3333

34-
This query only selects the API graph node corresponding to the ``re`` module. To find
35-
where this module is referenced, you can use the ``getAUse`` method. The following query selects
36-
all references to the ``re`` module in the current database.
34+
This query selects the API graph node corresponding to the ``re`` module. This node represents the fact that the ``re`` module has been imported rather than a specific location in the program where the import happens. Therefore, there will be at most one result per project, and it will not have a useful location, so you'll have to click `Show 1 non-source result` in order to see it.
35+
36+
To find where the ``re`` module is referenced in the program, you can use the ``getAUse`` method. The following query selects all references to the ``re`` module in the current database.
3737

3838
.. code-block:: ql
3939
@@ -102,7 +102,7 @@ where the return value of ``re.compile`` is used:
102102
Note that this includes all uses of the result of ``re.compile``, including those reachable via
103103
local flow. To get just the *calls* to ``re.compile``, you can use ``getAnImmediateUse`` instead of
104104
``getAUse``. As this is a common occurrence, you can use ``getACall`` instead of
105-
``getReturn`` followed by ``getAnImmediateUse``.
105+
``getReturn`` followed by ``getAnImmediateUse``.
106106

107107
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8143347716552092926/>`__.
108108

@@ -131,7 +131,7 @@ all subclasses of ``View``, you must explicitly include the subclasses of ``Meth
131131
result =
132132
API::moduleImport("flask").getMember("views").getMember(["View", "MethodView"]).getASubclass*()
133133
}
134-
134+
135135
select viewClass().getAUse()
136136
137137
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/288293322319747121/>`__.

0 commit comments

Comments
 (0)