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
7 changes: 3 additions & 4 deletions driver/normalizer/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,11 @@ var AnnotationRules = On(Any).Self(

// a.b.c ("a" and "b" will be Qualified, "c" will be just Identifier). Python does the
// reverse thing
On(pyast.Attribute).Self(
On(HasProperty("ctx", "Load")).Roles(uast.Qualified, uast.Identifier, uast.Expression),
On(HasProperty("ctx", "Store")).Roles(uast.Identifier, uast.Expression),
On(pyast.Attribute).Roles(uast.Identifier, uast.Expression).Self(
On(HasChild(pyast.Name)).Children(
On(Any).Roles(uast.Qualified), // Identifier and Expr added on all Name(s) below
On(pyast.Name).Roles(uast.Qualified), // Identifier and Expr added on all Name(s) below
),
On(HasInternalRole("value")).Roles(uast.Qualified),
),

On(pyast.Expression).Roles(uast.Expression),
Expand Down
16 changes: 8 additions & 8 deletions fixtures/classdef.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . . Children: {
. . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . . . TOKEN "_a"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 162
Expand Down Expand Up @@ -609,7 +609,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Attribute {
. . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Identifier,Expression
. . . . . . . . . . . TOKEN "setter"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 173
Expand Down Expand Up @@ -846,7 +846,7 @@ Module {
. . . . . }
. . . . . Children: {
. . . . . . 0: Attribute {
. . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . TOKEN "f"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 252
Expand All @@ -864,7 +864,7 @@ Module {
. . . . . . . }
. . . . . . . Children: {
. . . . . . . . 0: Attribute {
. . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . TOKEN "e"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 250
Expand All @@ -882,7 +882,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Attribute {
. . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . TOKEN "d"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 248
Expand All @@ -900,7 +900,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . . Children: {
. . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . . . TOKEN "c"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 246
Expand All @@ -918,7 +918,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . . . . . TOKEN "b"
. . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . Offset: 244
Expand Down Expand Up @@ -1024,7 +1024,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "method"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 262
Expand Down
2 changes: 1 addition & 1 deletion fixtures/functioncalls.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 3: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "qualifiedCall"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 44
Expand Down
18 changes: 9 additions & 9 deletions fixtures/issue130.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Module {
. . . . . . . . . }
. . . . . . . . }
. . . . . . . . 1: Attribute {
. . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . TOKEN "basename"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 21
Expand All @@ -75,7 +75,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Attribute {
. . . . . . . . . . . Roles: Call,Receiver,Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Call,Receiver,Identifier,Expression,Qualified
. . . . . . . . . . . TOKEN "path"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 16
Expand Down Expand Up @@ -117,7 +117,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "which"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 7
Expand Down Expand Up @@ -244,7 +244,7 @@ Module {
. . . . . . . . . }
. . . . . . . . }
. . . . . . . . 3: Attribute {
. . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . TOKEN "join"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 63
Expand All @@ -262,7 +262,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Attribute {
. . . . . . . . . . . Roles: Call,Receiver,Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Call,Receiver,Identifier,Expression,Qualified
. . . . . . . . . . . TOKEN "path"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 58
Expand Down Expand Up @@ -322,7 +322,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 2: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "copyfile"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 46
Expand Down Expand Up @@ -432,7 +432,7 @@ Module {
. . . . . . . . . }
. . . . . . . . }
. . . . . . . . 1: Attribute {
. . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . TOKEN "abspath"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 133
Expand All @@ -450,7 +450,7 @@ Module {
. . . . . . . . . }
. . . . . . . . . Children: {
. . . . . . . . . . 0: Attribute {
. . . . . . . . . . . Roles: Call,Receiver,Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Call,Receiver,Identifier,Expression,Qualified
. . . . . . . . . . . TOKEN "path"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 128
Expand Down Expand Up @@ -492,7 +492,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 2: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "info"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 104
Expand Down
4 changes: 2 additions & 2 deletions fixtures/issue30.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Module {
. . . . . . . }
. . . . . . }
. . . . . . 1: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "write"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 22
Expand All @@ -85,7 +85,7 @@ Module {
. . . . . . . }
. . . . . . . Children: {
. . . . . . . . 0: Attribute {
. . . . . . . . . Roles: Call,Receiver,Qualified,Identifier,Expression
. . . . . . . . . Roles: Call,Receiver,Identifier,Expression,Qualified
. . . . . . . . . TOKEN "stdout"
. . . . . . . . . StartPosition: {
. . . . . . . . . . Offset: 15
Expand Down
2 changes: 1 addition & 1 deletion fixtures/issue51.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Module {
. . . . . }
. . . . . Children: {
. . . . . . 0: Attribute {
. . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . TOKEN "figure"
. . . . . . . StartPosition: {
. . . . . . . . Offset: 4
Expand Down
18 changes: 9 additions & 9 deletions fixtures/issue62_b.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ Module {
. . . . . . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "token"
. . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 469
Expand Down Expand Up @@ -716,7 +716,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . TOKEN "roles"
. . . . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . . . Offset: 436
Expand Down Expand Up @@ -844,7 +844,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . 2: Attribute {
. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "collect_id_cnt"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 498
Expand Down Expand Up @@ -888,7 +888,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . }
. . . . . . . . . . . . 1: Attribute {
. . . . . . . . . . . . . Roles: Qualified,Identifier,Expression,For
. . . . . . . . . . . . . Roles: Identifier,Expression,For
. . . . . . . . . . . . . TOKEN "children"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 387
Expand Down Expand Up @@ -1211,7 +1211,7 @@ Module {
. . . . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . . . TOKEN "filepath"
. . . . . . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . . . . . Offset: 671
Expand Down Expand Up @@ -1371,7 +1371,7 @@ Module {
. . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "uast"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 764
Expand All @@ -1389,7 +1389,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . . . . . . . Roles: Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression,Qualified
. . . . . . . . . . . . . . . . . . . . . TOKEN "response"
. . . . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . . . Offset: 755
Expand Down Expand Up @@ -1447,7 +1447,7 @@ Module {
. . . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . }
. . . . . . . . . . . . . . . . . . 2: Attribute {
. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . . . . . . . . . TOKEN "collect_id_cnt"
. . . . . . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . . . . . Offset: 730
Expand Down Expand Up @@ -1812,7 +1812,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Attribute {
. . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . TOKEN "convert_repository"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 950
Expand Down
10 changes: 5 additions & 5 deletions fixtures/issue76.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . }
. . . . . . . . . . . . 1: Attribute {
. . . . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . . . TOKEN "join"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 86
Expand Down Expand Up @@ -117,7 +117,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . }
. . . . . . . . . . 1: Attribute {
. . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . TOKEN "write"
. . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . Offset: 75
Expand Down Expand Up @@ -192,7 +192,7 @@ Module {
. . . . . . . . . . . }
. . . . . . . . . . . Children: {
. . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Qualified,Identifier,Expression
. . . . . . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression
. . . . . . . . . . . . . TOKEN "output"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 28
Expand Down Expand Up @@ -247,7 +247,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . }
. . . . . . . . . . . . 2: Attribute {
. . . . . . . . . . . . . Roles: Call,Callee,Qualified,Identifier,Expression
. . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression
. . . . . . . . . . . . . TOKEN "join"
. . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . Offset: 18
Expand All @@ -265,7 +265,7 @@ Module {
. . . . . . . . . . . . . }
. . . . . . . . . . . . . Children: {
. . . . . . . . . . . . . . 0: Attribute {
. . . . . . . . . . . . . . . Roles: Call,Receiver,Qualified,Identifier,Expression
. . . . . . . . . . . . . . . Roles: Call,Receiver,Identifier,Expression,Qualified
. . . . . . . . . . . . . . . TOKEN "path"
. . . . . . . . . . . . . . . StartPosition: {
. . . . . . . . . . . . . . . . Offset: 13
Expand Down
Loading