Skip to content

Commit f07a7bf

Browse files
committed
Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
1 parent 993506d commit f07a7bf

File tree

602 files changed

+28074
-28087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

602 files changed

+28074
-28087
lines changed

python/ql/examples/snippets/catch_exception.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import python
1111

1212
from ExceptStmt ex, ClassValue cls
1313
where
14-
cls.getName() = "MyExceptionClass" and
15-
ex.getType().pointsTo(cls)
14+
cls.getName() = "MyExceptionClass" and
15+
ex.getType().pointsTo(cls)
1616
select ex

python/ql/examples/snippets/conditional_expression.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import python
1212

1313
from IfExp e, ClassObject cls1, ClassObject cls2
1414
where
15-
e.getBody().refersTo(_, cls1, _) and
16-
e.getOrelse().refersTo(_, cls2, _) and
17-
cls1 != cls2
15+
e.getBody().refersTo(_, cls1, _) and
16+
e.getOrelse().refersTo(_, cls2, _) and
17+
cls1 != cls2
1818
select e

python/ql/examples/snippets/emptythen.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import python
1414

1515
from If i
1616
where
17-
not exists(Stmt s |
18-
i.getStmt(_) = s and
19-
not s instanceof Pass
20-
)
17+
not exists(Stmt s |
18+
i.getStmt(_) = s and
19+
not s instanceof Pass
20+
)
2121
select i

python/ql/examples/snippets/extend_class.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ import python
1414

1515
from ClassObject sub, ClassObject base
1616
where
17-
base.getName() = "MyClass" and
18-
sub.getABaseType() = base
17+
base.getName() = "MyClass" and
18+
sub.getABaseType() = base
1919
select sub

python/ql/examples/snippets/method_call.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import python
1010

1111
from AstNode call, PythonFunctionValue method
1212
where
13-
method.getQualifiedName() = "MyClass.methodName" and
14-
method.getACall().getNode() = call
13+
method.getQualifiedName() = "MyClass.methodName" and
14+
method.getACall().getNode() = call
1515
select call

python/ql/examples/snippets/new_instance.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import python
1111

1212
from Call new, ClassValue cls
1313
where
14-
cls.getName() = "MyClass" and
15-
new.getFunc().pointsTo(cls)
14+
cls.getName() = "MyClass" and
15+
new.getFunc().pointsTo(cls)
1616
select new

python/ql/examples/snippets/override_method.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import python
1010

1111
from FunctionObject override, FunctionObject base
1212
where
13-
base.getQualifiedName() = "MyClass.methodName" and
14-
override.overrides(base)
13+
base.getQualifiedName() = "MyClass.methodName" and
14+
override.overrides(base)
1515
select override

python/ql/examples/snippets/print.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import python
99

1010
from AstNode print
1111
where
12-
/* Python 2 without `from __future__ import print_function` */
13-
print instanceof Print
14-
or
15-
/* Python 3 or with `from __future__ import print_function` */
16-
print.(Call).getFunc().pointsTo(Value::named("print"))
12+
/* Python 2 without `from __future__ import print_function` */
13+
print instanceof Print
14+
or
15+
/* Python 3 or with `from __future__ import print_function` */
16+
print.(Call).getFunc().pointsTo(Value::named("print"))
1717
select print

python/ql/examples/snippets/private_access.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import python
1010

1111
predicate is_private(Attribute a) {
12-
a.getName().matches("\\_%") and
13-
not a.getName().matches("\\_\\_%\\_\\_")
12+
a.getName().matches("\\_%") and
13+
not a.getName().matches("\\_\\_%\\_\\_")
1414
}
1515

1616
from Attribute access
1717
where
18-
is_private(access) and
19-
not access.getObject().(Name).getId() = "self"
18+
is_private(access) and
19+
not access.getObject().(Name).getId() = "self"
2020
select access

python/ql/examples/snippets/raise_exception.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import python
1111

1212
from Raise raise, ClassValue ex
1313
where
14-
ex.getName() = "AnException" and
15-
raise.getException().pointsTo(ex.getASuperType())
14+
ex.getName() = "AnException" and
15+
raise.getException().pointsTo(ex.getASuperType())
1616
select raise, "Don't raise instances of 'AnException'"

0 commit comments

Comments
 (0)