Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ANNOTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | CallPositionalArgument |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\] | CallNamedArgument |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallNamedArgumentValue |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | Call |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | CallCallee |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\] | CallCallee |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallReceiver |
| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\] | Assignment, Expression |
Expand Down
5 changes: 3 additions & 2 deletions driver/normalizer/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ var AnnotationRules = On(Any).Self(
On(HasInternalRole("value")).Roles(CallNamedArgumentValue),
),
On(HasInternalRole("func")).Self(
On(HasInternalType(pyast.Name)).Roles(Call),
On(HasInternalType(pyast.Name)).Roles(CallCallee),
On(HasInternalType(pyast.Attribute)).Roles(CallCallee).Children(
On(HasInternalRole("value")).Roles(CallReceiver),
)),
Expand Down Expand Up @@ -267,7 +267,8 @@ var AnnotationRules = On(Any).Self(
On(HasInternalType("ClassDef.bases")).Roles(TypeDeclarationBases),
On(HasInternalType("ClassDef.keywords")).Roles(Incomplete).Children(
On(HasInternalType(pyast.Keyword)).Roles(SimpleIdentifier, Incomplete),
)),
),
),

On(HasInternalType(pyast.For)).Roles(ForEach, Statement).Children(
On(HasInternalType("For.body")).Roles(ForBody),
Expand Down
2 changes: 1 addition & 1 deletion tests/classdef.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ Module {
. . . . . }
. . . . . Children: {
. . . . . . 0: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "Animal"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 225
Expand Down
8 changes: 4 additions & 4 deletions tests/except.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "Exception"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 25
Expand Down Expand Up @@ -213,7 +213,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 147
Expand Down Expand Up @@ -306,7 +306,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . }
. . . . . . . . . . . . 1: Name {
. . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 76
Expand Down Expand Up @@ -414,7 +414,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . }
. . . . . . . . . . . . 1: Name {
. . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 119
Expand Down
2 changes: 1 addition & 1 deletion tests/exec.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "exec"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 0
Expand Down
2 changes: 1 addition & 1 deletion tests/for.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 33
Expand Down
8 changes: 4 additions & 4 deletions tests/functioncalls.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 3: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "normalCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 0
Expand Down Expand Up @@ -299,7 +299,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "keyCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 87
Expand Down Expand Up @@ -482,7 +482,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 2: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "expandListCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 108
Expand Down Expand Up @@ -554,7 +554,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "expandMapCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 141
Expand Down
2 changes: 1 addition & 1 deletion tests/functiondef_decorated.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Module {
. . . . . . . . . }
. . . . . . . . }
. . . . . . . . 3: Name {
. . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . TOKEN "somedecoratorparams"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 44
Expand Down
2 changes: 1 addition & 1 deletion tests/hello.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "print"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 0
Expand Down
6 changes: 3 additions & 3 deletions tests/if.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 13
Expand Down Expand Up @@ -194,7 +194,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 49
Expand Down Expand Up @@ -234,7 +234,7 @@ Module {
. . . . . }
. . . . . Children: {
. . . . . . 0: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "functionCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 29
Expand Down
10 changes: 5 additions & 5 deletions tests/issue62_b.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ Module {
. . . . . . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . . . . 1: Name {
. . . . . . . . . . . . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . . . . . TOKEN "str"
. . . . . . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . . . . . Offset: 657
Expand All @@ -1459,7 +1459,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . 1: Name {
. . . . . . . . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 634
Expand Down Expand Up @@ -1528,7 +1528,7 @@ Module {
. . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . 0: Name {
. . . . . . . . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "Counter"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 703
Expand Down Expand Up @@ -1744,7 +1744,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . 1: Name {
. . . . . . . . . . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 790
Expand Down Expand Up @@ -1933,7 +1933,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "Repo2IdCounter"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 870
Expand Down
2 changes: 1 addition & 1 deletion tests/literals_assign.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ Module {
. . . . . . . . . }
. . . . . . . . }
. . . . . . . . 1: Name {
. . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . TOKEN "int"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 206
Expand Down
2 changes: 1 addition & 1 deletion tests/loop_if.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 39
Expand Down
2 changes: 1 addition & 1 deletion tests/repr.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "repr"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 0
Expand Down
4 changes: 2 additions & 2 deletions tests/sameline.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "print"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 0
Expand Down Expand Up @@ -135,7 +135,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Name {
. . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . TOKEN "print"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 25
Expand Down
2 changes: 1 addition & 1 deletion tests/string_fstring.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "somefunc"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 0
Expand Down
4 changes: 2 additions & 2 deletions tests/while.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 17
Expand Down Expand Up @@ -167,7 +167,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Name {
. . . . . . . . . . . Roles: Call,SimpleIdentifier,Expression
. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression
. . . . . . . . . . . TOKEN "print"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 58
Expand Down