Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c4a477

Browse files
committed
Python: Support moduleImport("dotted.name") in API graphs
1 parent 738d1bc commit 2c4a477

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

python/ql/src/semmle/python/ApiGraphs.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@ module API {
209209

210210
/**
211211
* Gets a node corresponding to an import of module `m`.
212-
*
213-
* Note: You should only use this predicate for top level modules. If you want nodes corresponding to a submodule,
214-
* you should use `.getMember` on the parent module. For example, for nodes corresponding to the module `foo.bar`,
215-
* use `moduleImport("foo").getMember("bar")`.
216212
*/
217-
Node moduleImport(string m) { result = Impl::MkModuleImport(m) }
213+
Node moduleImport(string m) {
214+
result = Impl::MkModuleImport(m)
215+
or
216+
exists(string before_dot, string after_dot | before_dot + "." + after_dot = m |
217+
result = moduleImport(before_dot).getMember(after_dot)
218+
)
219+
}
218220

219221
/**
220222
* Provides the actual implementation of API graphs, cached for performance.

0 commit comments

Comments
 (0)