-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16212 from github/tausbn/python-add-copy-of-inter…
…nal-tests Python: Add copy of internal tests
- Loading branch information
Showing
307 changed files
with
15,338 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import python | ||
|
||
select count(Ellipsis e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
a = {} | ||
a[...] = 1 | ||
b = a[ | ||
...] | ||
|
||
print(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
| test.py | 0 | Entry node for Module test | 1 | ControlFlowNode for FunctionExpr | normal | | ||
| test.py | 1 | ControlFlowNode for FunctionExpr | 1 | ControlFlowNode for f | normal | | ||
| test.py | 1 | ControlFlowNode for f | 0 | Exit node for Module test | normal | | ||
| test.py | 1 | ControlFlowNode for x | 2 | ControlFlowNode for exec | normal | | ||
| test.py | 1 | Entry node for Function f | 1 | ControlFlowNode for x | normal | | ||
| test.py | 2 | ControlFlowNode for Str | 2 | ControlFlowNode for exec() | normal | | ||
| test.py | 2 | ControlFlowNode for exec | 2 | ControlFlowNode for Str | normal | | ||
| test.py | 2 | ControlFlowNode for exec() | 3 | ControlFlowNode for x | normal | | ||
| test.py | 3 | ControlFlowNode for Return | 1 | Exit node for Function f | normal | | ||
| test.py | 3 | ControlFlowNode for x | 3 | ControlFlowNode for Return | normal | | ||
| unicode.py | 0 | Entry node for Module unicode | 1 | ControlFlowNode for ImportExpr | normal | | ||
| unicode.py | 1 | ControlFlowNode for ImportExpr | 1 | ControlFlowNode for ImportMember | normal | | ||
| unicode.py | 1 | ControlFlowNode for ImportMember | 1 | ControlFlowNode for unicode_literals | normal | | ||
| unicode.py | 1 | ControlFlowNode for unicode_literals | 3 | ControlFlowNode for FunctionExpr | normal | | ||
| unicode.py | 3 | ControlFlowNode for FunctionExpr | 3 | ControlFlowNode for f | normal | | ||
| unicode.py | 3 | ControlFlowNode for f | 0 | Exit node for Module unicode | normal | | ||
| unicode.py | 3 | ControlFlowNode for x | 4 | ControlFlowNode for exec | normal | | ||
| unicode.py | 3 | Entry node for Function f | 3 | ControlFlowNode for x | normal | | ||
| unicode.py | 4 | ControlFlowNode for Str | 4 | ControlFlowNode for exec() | normal | | ||
| unicode.py | 4 | ControlFlowNode for exec | 4 | ControlFlowNode for Str | normal | | ||
| unicode.py | 4 | ControlFlowNode for exec() | 5 | ControlFlowNode for x | normal | | ||
| unicode.py | 5 | ControlFlowNode for Return | 3 | Exit node for Function f | normal | | ||
| unicode.py | 5 | ControlFlowNode for x | 5 | ControlFlowNode for Return | normal | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import python | ||
|
||
from ControlFlowNode p, ControlFlowNode s, string kind, string filename | ||
where | ||
p.getASuccessor() = s and | ||
( | ||
p.getAnExceptionalSuccessor() = s and kind = "exception" | ||
or | ||
not p.getAnExceptionalSuccessor() = s and kind = "normal" | ||
) and | ||
filename = p.getLocation().getFile().getShortName() and | ||
not filename = "__future__.py" | ||
select filename, p.getLocation().getStartLine(), p.toString(), s.getLocation().getStartLine(), | ||
s.toString(), kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def f(x): | ||
exec("raise thing") | ||
return x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import unicode_literals | ||
|
||
def f(x): | ||
exec("raise thing") | ||
return x |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
semmle-extractor-options: -R . -p . --filter exclude:**/src_archive/** | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
| folder/module.py | | ||
| package | | ||
| package/__init__.py | | ||
| package/module.py | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import python | ||
|
||
from Container f | ||
where exists(Module m | m.getPath() = f) | ||
select f.toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
semmle-extractor-options: --lang=2 --max-import-depth=1 |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
| Module package | | ||
| Module package.__init__ | | ||
| Module sys | | ||
| Module test | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import python | ||
|
||
from ModuleObject m | ||
/* Exclude the builtins module as it has a different name under 2 and 3. */ | ||
where not m = theBuiltinModuleObject() | ||
select m.toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
| test.py:3:1:3:11 | Str | \u0111\u0142e\u00b6\u014b\u00b6\u0142\u014b | | ||
| test.py:3:15:3:19 | Str | hi | | ||
| test.py:3:23:3:27 | Str | \n | | ||
| test.py:4:1:4:11 | Str | \u0111\u0142e\u00b6\u014b\u00b6\u0142\u014b | | ||
| test.py:4:15:4:19 | Str | hi | | ||
| test.py:4:23:4:27 | Str | \n | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
from StrConst s | ||
select s, s.getText() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
automatic_locations: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#coding=utf8 | ||
|
||
b"đłe¶ŋ¶łŋ" + b"hi" + b"\n" | ||
u"đłe¶ŋ¶łŋ" + u"hi" + u"\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
| int 0 | 0 | | ||
| int 1 | 1 | | ||
| int 2 | 2 | | ||
| int 123745 | 123745 | | ||
| int 268435455 | 268435455 | | ||
| int 17216961135462248174 | 17216961135462248174 | | ||
| int 100000000000000000000000000000000000000000000 | 100000000000000000000000000000000000000000000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Much of the QL library handling integral values assumes that | ||
* equivalence of the DB entities implies equivalence of the | ||
* Python object and vice-versa. | ||
* In Python 2, 1L == 1, which can cause problems, so we | ||
* normalise all longs to ints. | ||
*/ | ||
|
||
import python | ||
|
||
from NumericObject n | ||
where | ||
exists(IntegerLiteral i | i.getLiteralObject() = n | | ||
i.getEnclosingModule().getFile().getShortName() = "test.py" | ||
) | ||
select n.toString(), n.repr() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#ints | ||
0 | ||
0L | ||
1 | ||
1L | ||
2 | ||
2L | ||
123745 | ||
123745L | ||
|
||
0xfffffff | ||
0xfffffffL | ||
|
||
#Avoid values between 32 and 64 bits, as long is 32 bits on windows and 64 bits on 64 bit linux machines. | ||
|
||
|
||
|
||
#longs | ||
0xeeeeeeeeeeeeeeee | ||
0xeeeeeeeeeeeeeeeeL | ||
100000000000000000000000000000000000000000000 | ||
100000000000000000000000000000000000000000000L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
where exists(theSysModuleObject()) | ||
select 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import cStringIO |
1 change: 1 addition & 0 deletions
1
python/ql/test/2/extractor-tests/old_style_disequality/test.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| test.py:1:1:1:6 | Compare | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 <> 2 |
3 changes: 3 additions & 0 deletions
3
python/ql/test/2/extractor-tests/old_style_disequality/test.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import python | ||
|
||
select any(Compare o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
automatic_locations: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| Module test | test | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
from Module m | ||
select m.toString(), m.getName() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| Syntax Error | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
from SyntaxError s | ||
select s.toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
Not python at all :( |
35 changes: 35 additions & 0 deletions
35
python/ql/test/2/library-tests/locations2.7plus/Locations.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
| Call | 2 | 17 | 2 | 28 | | ||
| DictComp | 2 | 1 | 2 | 29 | | ||
| ExprStmt | 2 | 1 | 2 | 29 | | ||
| ExprStmt | 2 | 2 | 2 | 4 | | ||
| ExprStmt | 3 | 1 | 3 | 14 | | ||
| ExprStmt | 4 | 1 | 4 | 16 | | ||
| ExprStmt | 4 | 3 | 4 | 3 | | ||
| FastLocalsFunction | 2 | 1 | 2 | 29 | | ||
| FastLocalsFunction | 4 | 1 | 4 | 16 | | ||
| For | 2 | 1 | 2 | 29 | | ||
| For | 4 | 1 | 4 | 16 | | ||
| FunctionMetrics | 2 | 1 | 2 | 29 | | ||
| FunctionMetrics | 4 | 1 | 4 | 16 | | ||
| IntegerLiteral | 3 | 3 | 3 | 3 | | ||
| IntegerLiteral | 3 | 6 | 3 | 6 | | ||
| IntegerLiteral | 3 | 9 | 3 | 9 | | ||
| IntegerLiteral | 3 | 12 | 3 | 12 | | ||
| ModuleMetrics | 0 | 0 | 0 | 0 | | ||
| Name | 2 | 1 | 2 | 29 | | ||
| Name | 2 | 2 | 2 | 2 | | ||
| Name | 2 | 4 | 2 | 4 | | ||
| Name | 2 | 10 | 2 | 10 | | ||
| Name | 2 | 12 | 2 | 12 | | ||
| Name | 2 | 17 | 2 | 25 | | ||
| Name | 2 | 27 | 2 | 27 | | ||
| Name | 4 | 1 | 4 | 16 | | ||
| Name | 4 | 3 | 4 | 3 | | ||
| Name | 4 | 9 | 4 | 9 | | ||
| Name | 4 | 14 | 4 | 14 | | ||
| Set | 3 | 1 | 3 | 14 | | ||
| SetComp | 4 | 1 | 4 | 16 | | ||
| Tuple | 2 | 2 | 2 | 4 | | ||
| Tuple | 2 | 10 | 2 | 12 | | ||
| Yield | 2 | 2 | 2 | 4 | | ||
| Yield | 4 | 3 | 4 | 3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import python | ||
|
||
from AstNode ast, Location l | ||
where ast.getLocation() = l | ||
select ast.getAQlClass(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
{k:v for k,v in enumerate(y)} | ||
{ 1, 2, 3, 4 } | ||
{ i for i in y } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| Script \u0ca8\u0ca8\u0ccd\u0ca8_\u0cb8\u0ccd\u0c95\u0ccd\u0cb0\u0cbf\u0caa\u0ccd\u0c9f\u0ccd.py | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
from Module m | ||
select m.toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
from dbgimporter import import_and_enable_debugger | ||
import_and_enable_debugger() | ||
def ಏನಾದರೂ_ಮಾಡು(): | ||
print('ಏನೋ ಮಾಡಿದೆ'.encode(sys.stdout.encoding, errors='replace')) | ||
|
||
|
||
ಏನಾದರೂ_ಮಾಡು() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
| 1 | AnnAssign | x | int | IntegerLiteral | | ||
| 2 | AnnAssign | y | Thing | something() | | ||
| 3 | AnnAssign | z | Any | ---- | | ||
| 4 | AnnAssign | Attribute | complex | ---- | | ||
| 5 | AnnAssign | Attribute | not_simple | None | | ||
| 8 | AnnAssign | a | int | IntegerLiteral | | ||
| 9 | AnnAssign | b | Thing | something() | | ||
| 10 | AnnAssign | c | Any | ---- | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import python | ||
|
||
from AnnAssign a, string value | ||
where | ||
value = a.getValue().toString() | ||
or | ||
not exists(a.getValue()) and value = "----" | ||
select a.getLocation().getStartLine(), a.toString(), a.getTarget().toString(), | ||
a.getAnnotation().toString(), value |
38 changes: 38 additions & 0 deletions
38
python/ql/test/3/extractor-tests/annotations/Locations.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
| 0 | 0 | 0 | 0 | Module test | | ||
| 1 | 1 | 1 | 1 | x | | ||
| 1 | 1 | 1 | 10 | AnnAssign | | ||
| 1 | 4 | 1 | 6 | int | | ||
| 1 | 10 | 1 | 10 | IntegerLiteral | | ||
| 2 | 1 | 2 | 1 | y | | ||
| 2 | 1 | 2 | 22 | AnnAssign | | ||
| 2 | 4 | 2 | 8 | Thing | | ||
| 2 | 12 | 2 | 20 | something | | ||
| 2 | 12 | 2 | 22 | something() | | ||
| 3 | 1 | 3 | 1 | z | | ||
| 3 | 1 | 3 | 6 | AnnAssign | | ||
| 3 | 4 | 3 | 6 | Any | | ||
| 4 | 1 | 4 | 1 | a | | ||
| 4 | 1 | 4 | 3 | Attribute | | ||
| 4 | 1 | 4 | 13 | AnnAssign | | ||
| 4 | 7 | 4 | 13 | complex | | ||
| 5 | 1 | 5 | 1 | c | | ||
| 5 | 1 | 5 | 3 | Attribute | | ||
| 5 | 1 | 5 | 23 | AnnAssign | | ||
| 5 | 7 | 5 | 16 | not_simple | | ||
| 5 | 20 | 5 | 23 | None | | ||
| 7 | 1 | 7 | 8 | Function f | | ||
| 7 | 1 | 7 | 8 | FunctionDef | | ||
| 7 | 1 | 7 | 8 | FunctionExpr | | ||
| 7 | 5 | 7 | 5 | f | | ||
| 8 | 5 | 8 | 5 | a | | ||
| 8 | 5 | 8 | 14 | AnnAssign | | ||
| 8 | 8 | 8 | 10 | int | | ||
| 8 | 14 | 8 | 14 | IntegerLiteral | | ||
| 9 | 5 | 9 | 5 | b | | ||
| 9 | 5 | 9 | 26 | AnnAssign | | ||
| 9 | 8 | 9 | 12 | Thing | | ||
| 9 | 16 | 9 | 24 | something | | ||
| 9 | 16 | 9 | 26 | something() | | ||
| 10 | 5 | 10 | 5 | c | | ||
| 10 | 5 | 10 | 10 | AnnAssign | | ||
| 10 | 8 | 10 | 10 | Any | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import python | ||
|
||
from AstNode a, Location l | ||
where l = a.getLocation() | ||
select l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn(), a.toString() |
34 changes: 34 additions & 0 deletions
34
python/ql/test/3/extractor-tests/annotations/Successors.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
| 0 | Module test | 1 | IntegerLiteral | | ||
| 1 | AnnAssign | 2 | something | | ||
| 1 | IntegerLiteral | 1 | x | | ||
| 1 | int | 1 | AnnAssign | | ||
| 1 | x | 1 | int | | ||
| 2 | AnnAssign | 3 | z | | ||
| 2 | Thing | 2 | AnnAssign | | ||
| 2 | something | 2 | something() | | ||
| 2 | something() | 2 | y | | ||
| 2 | y | 2 | Thing | | ||
| 3 | AnnAssign | 4 | a | | ||
| 3 | Any | 3 | AnnAssign | | ||
| 3 | z | 3 | Any | | ||
| 4 | AnnAssign | 5 | None | | ||
| 4 | Attribute | 4 | complex | | ||
| 4 | a | 4 | Attribute | | ||
| 4 | complex | 4 | AnnAssign | | ||
| 5 | AnnAssign | 7 | FunctionExpr | | ||
| 5 | Attribute | 5 | not_simple | | ||
| 5 | None | 5 | c | | ||
| 5 | c | 5 | Attribute | | ||
| 5 | not_simple | 5 | AnnAssign | | ||
| 7 | Function f | 8 | IntegerLiteral | | ||
| 7 | FunctionExpr | 7 | f | | ||
| 7 | f | 0 | Module test | | ||
| 8 | AnnAssign | 9 | something | | ||
| 8 | IntegerLiteral | 8 | a | | ||
| 8 | a | 8 | AnnAssign | | ||
| 9 | AnnAssign | 10 | c | | ||
| 9 | b | 9 | AnnAssign | | ||
| 9 | something | 9 | something() | | ||
| 9 | something() | 9 | b | | ||
| 10 | AnnAssign | 7 | Function f | | ||
| 10 | c | 10 | AnnAssign | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import python | ||
|
||
from ControlFlowNode p, ControlFlowNode s | ||
where p.getASuccessor() = s | ||
select p.getLocation().getStartLine(), p.getNode().toString(), s.getLocation().getStartLine(), | ||
s.getNode().toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
x: int = 0 | ||
y: Thing = something() | ||
z: Any | ||
a.x : complex | ||
c.y : not_simple = None | ||
|
||
def f(): | ||
a: int = 0 | ||
b: Thing = something() | ||
c: Any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| 3 | For | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import python | ||
|
||
from AsyncFor a | ||
select a.getLocation().getStartLine(), a.toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| 4 | With | |
Oops, something went wrong.