Skip to content

Commit 6c69c1a

Browse files
authored
Python: Minor cleanup
1 parent a93132d commit 6c69c1a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

python/ql/src/semmle/python/Files.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class File extends Container {
7474
string getContents() { file_contents(this, result) }
7575

7676
/** Holds if this file is likely to get executed directly, and thus act as an entry point for execution. */
77-
predicate maybeExecutedDirectly() {
77+
predicate isPossibleEntryPoint() {
7878
// Only consider files in the source code, and not things like the standard library
7979
exists(this.getRelativePath()) and
8080
(
@@ -148,9 +148,6 @@ class Folder extends Container {
148148
this.getBaseName().regexpMatch("[^\\d\\W]\\w*") and
149149
result = this.getParent().getImportRoot(n)
150150
}
151-
152-
/** Holds if execution may start in a file in this directory. */
153-
predicate mayContainEntryPoint() { any(File f | f.getParent() = this).maybeExecutedDirectly() }
154151
}
155152

156153
/**

python/ql/src/semmle/python/Module.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private predicate transitively_imported_from_entry_point(File file) {
211211
importer.getParent() = file.getParent() and
212212
exists(ImportExpr i | i.getLocation().getFile() = importer and i.getName() = file.getStem())
213213
|
214-
importer.maybeExecutedDirectly() or transitively_imported_from_entry_point(importer)
214+
importer.isPossibleEntryPoint() or transitively_imported_from_entry_point(importer)
215215
)
216216
}
217217

0 commit comments

Comments
 (0)