Python: Apply autoformat.

This commit is contained in:
Taus Brock-Nannestad
2019-10-21 16:15:48 +02:00
parent 4fe1ba0ea4
commit ab2c8f312c

View File

@@ -14,18 +14,20 @@
import python
/** Whether name is declared in the __all__ list of this module */
predicate declaredInAll(Module m, StrConst name)
{
exists(Assign a, GlobalVariable all |
a.defines(all) and a.getScope() = m and
all.getId() = "__all__" and ((List)a.getValue()).getAnElt() = name
predicate declaredInAll(Module m, StrConst name) {
exists(Assign a, GlobalVariable all |
a.defines(all) and
a.getScope() = m and
all.getId() = "__all__" and
a.getValue().(List).getAnElt() = name
)
}
predicate mutates_globals(ModuleValue m) {
exists(CallNode globals |
globals = Object::builtin("globals").(FunctionObject).getACall() and
globals.getScope() = m.getScope() |
globals.getScope() = m.getScope()
|
exists(AttrNode attr | attr.getObject() = globals)
or
exists(SubscriptNode sub | sub.getValue() = globals and sub.isStore())
@@ -33,9 +35,7 @@ predicate mutates_globals(ModuleValue m) {
or
exists(Object enum_convert |
enum_convert.hasLongName("enum.Enum._convert") and
exists(CallNode call |
call.getScope() = m.getScope()
|
exists(CallNode call | call.getScope() = m.getScope() |
enum_convert.(FunctionObject).getACall() = call or
call.getFunction().refersTo(enum_convert)
)