Python: Minor cleanup

This commit is contained in:
Taus
2021-04-07 10:47:21 +00:00
committed by GitHub
parent a93132daae
commit 6c69c1aeeb
2 changed files with 2 additions and 5 deletions

View File

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

View File

@@ -211,7 +211,7 @@ private predicate transitively_imported_from_entry_point(File file) {
importer.getParent() = file.getParent() and
exists(ImportExpr i | i.getLocation().getFile() = importer and i.getName() = file.getStem())
|
importer.maybeExecutedDirectly() or transitively_imported_from_entry_point(importer)
importer.isPossibleEntryPoint() or transitively_imported_from_entry_point(importer)
)
}