diff --git a/Gopkg.lock b/Gopkg.lock index c1a21c5f..6221e1e4 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -121,6 +121,12 @@ packages = ["go/otgrpc"] revision = "8e809c8a86450a29b90dcc9efbf062d0fe6d9746" +[[projects]] + branch = "master" + name = "github.com/heetch/lapjv" + packages = ["."] + revision = "56ca12528a83c4589a73aff232e3d668dedf6099" + [[projects]] name = "github.com/jessevdk/go-flags" packages = ["."] @@ -388,6 +394,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "de848e8d06535c0133ff260a9efc285d0203fcc9f0cc027ff01e10d864a21e77" + inputs-digest = "0c0b5c035e953eee91113d0202dd9c471388ca51aa4c22b8a7544d6f7beddbbd" solver-name = "gps-cdcl" solver-version = 1 diff --git a/uast/diff/apply.go b/uast/diff/apply.go new file mode 100644 index 00000000..f3d05168 --- /dev/null +++ b/uast/diff/apply.go @@ -0,0 +1,70 @@ +package diff + +import ( + "errors" + "fmt" + + "gopkg.in/bblfsh/sdk.v2/uast/nodes" +) + +// Apply is a method that takes a tree (nodes.Node) and applies the current changelist to +// that tree. +func (cl Changelist) Apply(root nodes.Node) (nodes.Node, error) { + nodeDict := make(map[ID]nodes.Node) + nodes.WalkPreOrder(root, func(node nodes.Node) bool { + nodeDict[nodes.UniqueKey(node)] = node + return true + }) + + for _, change := range cl { + switch ch := change.(type) { + case Create: + // create a node and add to the dictionary + nodeDict[nodes.UniqueKey(ch.Node)] = ch.Node + + case Attach: + // get src and chld from the dictionary, attach (modify src) + parent, ok := nodeDict[ch.Parent] + if !ok { + return nil, errors.New("diff: invalid attachment point") + } + child, ok := nodeDict[ch.Child] + if !ok { + child, ok = ch.Child.(nodes.Value) + if !ok { + return nil, fmt.Errorf("diff: unknown type of a child: %T", ch.Child) + } + } + + switch key := ch.Key.(type) { + case String: + parent := parent.(nodes.Object) + parent[string(key)] = child + case Int: + parent := parent.(nodes.Array) + parent[int(key)] = child + default: + return nil, fmt.Errorf("diff: unknown type of a key: %T", ch.Key) + } + case Detach: + // get the src from the dictionary, deatach (modify src) + parent := nodeDict[ch.Parent] + + switch key := ch.Key.(type) { + case String: + parent := parent.(nodes.Object) + delete(parent, string(key)) + case Int: + return nil, errors.New("diff: cannot detach from an Array") + default: + return nil, fmt.Errorf("diff: unknown type of a key: %T", ch.Key) + } + + case Delete: + return nil, errors.New("diff: delete is not supported in a Changelist") + default: + return nil, fmt.Errorf("diff: unknown change of type %T", change) + } + } + return root, nil +} diff --git a/uast/diff/changelist.go b/uast/diff/changelist.go new file mode 100644 index 00000000..dcd44b5a --- /dev/null +++ b/uast/diff/changelist.go @@ -0,0 +1,88 @@ +package diff + +import ( + "gopkg.in/bblfsh/sdk.v2/uast/nodes" +) + +// Changelist is a list of changes, a result of tree difference. Applying all changes from a +// changelist on a source tree will result in it being transformed into the destination tree. +type Changelist []Change + +// Change is a single operation performed +type Change interface { + isChange() + // GroupID is the same for multiple changes that are a part of one high-level operation. + GroupID() uint64 +} + +// ID is a type representing node unique ID that can be compared in O(1) +type ID nodes.Comparable + +// Key in a node, string for nodes.Object and int for nodes.Array +type Key interface{ isKey() } + +// String is a wrapped string type for the Key interface. +type String string + +// Int is a wrapped int type for the Key interface. +type Int int + +func (Int) isKey() {} +func (String) isKey() {} + +// four change types + +// Create a node. Each array and object is created separately. +type Create struct { + group uint64 + + // Node to create. + Node nodes.Node +} + +func (Create) isChange() {} + +func (ch Create) GroupID() uint64 { return ch.group } + +// Delete a node by ID +type Delete struct { + group uint64 + + // Node to delete. + Node ID +} + +func (Delete) isChange() {} + +func (ch Delete) GroupID() uint64 { return ch.group } + +// Attach a node as a child of another node with a given key +type Attach struct { + group uint64 + + // Parent node ID to attach the key to. + Parent ID + // Key to attach. + Key Key + // Child to attach on a given key. + Child ID +} + +func (Attach) isChange() {} + +func (ch Attach) GroupID() uint64 { return ch.group } + +// Detach a child from a node +type Detach struct { + group uint64 + + // Parent node ID to detach the key from. + Parent ID + // Key to detach. Currently detach semantics are only defined for nodes.Object so the + // Key is practically always a String. + Key Key +} + +func (Detach) isChange() {} + +func (ch Detach) GroupID() uint64 { return ch.group } diff --git a/uast/diff/changelist_test.go b/uast/diff/changelist_test.go new file mode 100644 index 00000000..b2e4f7fc --- /dev/null +++ b/uast/diff/changelist_test.go @@ -0,0 +1,49 @@ +package diff + +import ( + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/require" + "gopkg.in/bblfsh/sdk.v2/uast/nodes" + uastyml "gopkg.in/bblfsh/sdk.v2/uast/yaml" +) + +const dataDir = "./testdata" + +func readUAST(t testing.TB, path string) nodes.Node { + data, err := ioutil.ReadFile(path) + require.NoError(t, err) + nd, err := uastyml.Unmarshal(data) + require.NoError(t, err) + return nd +} + +func TestChangelist(t *testing.T) { + dir, err := os.Open(dataDir) + require.NoError(t, err) + defer dir.Close() + names, err := dir.Readdirnames(-1) + require.NoError(t, err) + + for _, fname := range names { + if strings.HasSuffix(fname, "_src.uast") { + name := fname[:len(fname)-len("_src.uast")] + + t.Run(name, func(t *testing.T) { + srcName := filepath.Join(dataDir, name+"_src.uast") + dstName := filepath.Join(dataDir, name+"_dst.uast") + src := readUAST(t, srcName) + dst := readUAST(t, dstName) + + changes := Changes(src, dst) + newsrc, err := changes.Apply(src) + require.NoError(t, err) + require.True(t, nodes.Equal(newsrc, dst)) + }) + } + } +} diff --git a/uast/diff/create-testdata/main.go b/uast/diff/create-testdata/main.go new file mode 100644 index 00000000..8910a77b --- /dev/null +++ b/uast/diff/create-testdata/main.go @@ -0,0 +1,65 @@ +package main + +import ( + "bufio" + "flag" + "fmt" + "os" + "path/filepath" + "strconv" +) + +// This is a script used to generate test data for the diff library. It uses pairs of files +// to get diffed acquired from +// https://github.com/vmarkovtsev/treediff/blob/49356e7f85c261ed88cf46326791765c58c22b5b/dataset/flask.tar.xz +// It uses https://github.com/bblfsh/client-go#Installation to convert python sources into +// uast yaml files. +// This program outputs commands on the stdout - they are to be piped to sh/bash. It's a good +// idea to inspect them before running by just reading the textual output of the program. +// The program needs to be ran with proper commandline arguments. Example below. The cli arguments +// are also documented if you run `go run ./uast-diff-create-testdata --help`. +// $ go run ./create-testdata/ -d ~/data/sourced/treediff/python-dataset -f smalltest.txt -o . | sh - + +var ( + datasetPath = flag.String("d", "./", "Path to the python-dataset (unpacked flask.tar.gz)") + testnamesPath = flag.String("f", "./smalltest.txt", "File with testnames") + outPath = flag.String("o", "./", "Output directory") +) + +func firstFile(dirname string, fnamePattern string) string { + fns, err := filepath.Glob(filepath.Join(dirname, fnamePattern)) + if err != nil { + panic(err) + } + return fns[0] +} + +func main() { + flag.Parse() + _, err := os.Stat(*datasetPath) + if err != nil { + panic(err) + } + + testnames, err := os.Open(*testnamesPath) + if err != nil { + panic(err) + } + defer testnames.Close() + + scanner := bufio.NewScanner(testnames) + + for i := 0; scanner.Scan(); i++ { + name := scanner.Text() + if name == "" { + continue + } + src := firstFile(*datasetPath, name+"_before*.src") + dst := firstFile(*datasetPath, name+"_after*.src") + iStr := strconv.Itoa(i) + fmt.Println("bblfsh-cli -l python " + src + " -o yaml > " + + filepath.Join(*outPath, iStr+"_src.uast")) + fmt.Println("bblfsh-cli -l python " + dst + " -o yaml > " + + filepath.Join(*outPath, iStr+"_dst.uast")) + } +} diff --git a/uast/diff/create-testdata/smalltest.txt b/uast/diff/create-testdata/smalltest.txt new file mode 100644 index 00000000..c92d3c74 --- /dev/null +++ b/uast/diff/create-testdata/smalltest.txt @@ -0,0 +1,148 @@ +720_1 +721_0 +1360_2 +712_1 +714_1 +721_0 +763_2 +1233_19 +1360_2 +702_18 +763_2 +714_1 +720_1 +1154_0 +1195_0 +296_3 +640_2 +1233_21 +640_4 +447_3 +1154_0 +1195_0 +1249_1 +1233_22 +640_3 +447_3 +1144_0 +1172_0 +1233_23 +1281_8 +1403_2 +640_3 +702_3 +1353_6 +16_2 +36_0 +618_5 +62_0 +730_8 +781_1 +16_2 +17_1 +296_3 +36_0 +442_2 +294_0 +296_0 +1009_27 +1095_28 +296_0 +297_1 +303_0 +311_0 +1154_2 +1281_4 +1346_72 +1391_5 +1353_6 +442_2 +638_3 +730_4 +765_2 +1346_72 +311_0 +313_0 +319_0 +765_2 +865_2 +1095_12 +1095_2 +1154_2 +1281_16 +319_0 +357_2 +360_4 +776_0 +551_1 +296_6 +1408_8 +360_4 +376_0 +520_2 +530_18 +535_0 +551_1 +555_1 +535_0 +555_1 +556_2 +575_2 +865_2 +961_5 +1240_3 +1281_44 +1408_8 +556_2 +579_2 +618_2 +623_1 +1095_29 +1240_3 +575_2 +578_0 +593_0 +594_0 +605_0 +613_0 +618_2 +705_3 +706_3 +731_6 +867_2 +1346_102 +1391_5 +322_0 +623_1 +638_0 +1009_27 +638_0 +730_0 +731_6 +779_0 +780_1 +867_0 +1095_18 +334_2 +530_23 +560_3 +730_7 +867_0 +877_2 +904_2 +296_6 +334_4 +530_23 +531_3 +560_3 +618_5 +730_6 +788_1 +904_2 +909_3 +1095_14 +322_0 +323_1 +909_3 +910_1 +915_9 diff --git a/uast/diff/diff.go b/uast/diff/diff.go new file mode 100644 index 00000000..9d9e8aa7 --- /dev/null +++ b/uast/diff/diff.go @@ -0,0 +1,310 @@ +package diff + +import ( + "fmt" + + "github.com/heetch/lapjv" + "gopkg.in/bblfsh/sdk.v2/uast/nodes" +) + +type decision interface { + cost() int +} + +type same struct { + c int +} +type replace struct { + c int +} +type match struct { + c int +} +type permute struct { + c int + permutation []int +} + +func (d same) cost() int { return d.c } +func (d replace) cost() int { return d.c } +func (d match) cost() int { return d.c } +func (d permute) cost() int { return d.c } + +// min is a convenience method for choosing the cheapest decision +func min(self, candidate decision) decision { + if self.cost() > candidate.cost() { + return candidate + } + return self +} + +// keyType for cache +type keyType struct{ k1, k2 ID } + +// cacheStorage is a cache for diff computation +type cacheStorage struct { + lastGroup uint64 + decisions map[keyType]decision + counts map[ID]int + changes Changelist +} + +func (ds *cacheStorage) newGroup() uint64 { + ds.lastGroup++ + return ds.lastGroup +} + +func makeCacheStorage() *cacheStorage { + return &cacheStorage{ + decisions: make(map[keyType]decision), + counts: make(map[ID]int), + } +} + +// nodeSize caches (for perf) tree size (node count) +func (ds *cacheStorage) nodeSize(n nodes.Node) int { + label := nodes.UniqueKey(n) + if cnt, ok := ds.counts[label]; ok { + return cnt + } + ret := nodes.Count(n, nodes.KindsNotNil) + ds.counts[label] = ret + return ret +} + +// decideAction finds the cheapest way to naively match src and dst and returns this action +// with its combined cost +func (ds *cacheStorage) decideAction(src, dst nodes.Node) decision { + label := keyType{nodes.UniqueKey(src), nodes.UniqueKey(dst)} + + if val, ok := ds.decisions[label]; ok { + return val + } + + // the default (but not always optimal) decision is to ignore the existance of src and + // just create the desired dst; implemented below + cost := ds.nodeSize(dst) + 1 + + var best decision = replace{cost} + if nodes.KindOf(src) != nodes.KindOf(dst) { + ds.decisions[label] = best + return best + } + + // from now on src.(type) == dst.(type) + + switch src := src.(type) { + case nil: + cost = 0 + best = min(best, same{cost}) + case nodes.Value: + dst := dst.(nodes.Value) + cost = 0 + if src == dst { + best = min(best, same{cost}) + } else { + cost = 1 + best = min(best, replace{cost}) + } + case nodes.Object: + dst := dst.(nodes.Object) + cost = 0 + + // the code below iterates over each of the keys from src and dst exactly once, + // that's why keys isn't reset between iterations. + for _, key := range src.Keys() { + cost += ds.decideAction(src[key], dst[key]).cost() + } + for _, key := range dst.Keys() { + if _, in := src[key]; !in { + cost += ds.decideAction(src[key], dst[key]).cost() + } + } + + if cost == 0 { + best = min(best, same{cost}) + } else { + best = min(best, match{cost}) + } + case nodes.Array: + dst := dst.(nodes.Array) + cost = 0 + if len(src) == len(dst) { + sum := 0 + for i := range src { + sum += ds.decideAction(src[i], dst[i]).cost() + } + if sum == 0 { + best = min(best, same{cost}) + break + } + } else { + cost = 2 + } + + if len(src) < len(dst) { + arr := make(nodes.Array, len(dst)) + copy(arr, src) + src = arr + } else if len(src) > len(dst) { + arr := make(nodes.Array, len(src)) + copy(arr, dst) + dst = arr + } + n := len(src) + m := make([][]int, n) + for i := range src { + m[i] = make([]int, n) + for j := range dst { + m[i][j] = ds.decideAction(src[i], dst[j]).cost() + } + } + + res := lapjv.Lapjv(m) + + for i1, i2 := range res.InRow { + if i1 != i2 { + cost = 2 + break + } + } + + cost += res.Cost + best = min(best, permute{cost, res.InRow}) + default: + panic(fmt.Errorf("unknown node type %T", src)) + } + + ds.decisions[label] = best + return best +} + +func (ds *cacheStorage) push(change Change) { + ds.changes = append(ds.changes, change) +} + +func (ds *cacheStorage) createRec(group uint64, node nodes.Node) { + switch n := node.(type) { + case nodes.Object: + for _, v := range n { + ds.createRec(group, v) + } + case nodes.Array: + for _, v := range n { + ds.createRec(group, v) + } + default: + // values and nils are not saved separately + return + } + ds.push(Create{group: group, Node: node}) +} + +func (ds *cacheStorage) generateDifference(src, dst nodes.Node, parentID ID, parentKey Key) { + switch d := ds.decideAction(src, dst).(type) { + case same: + // no action required if same + case replace: + g := ds.newGroup() + // remove src (no action?) and create dst + attach it + if dst != nil { + ds.createRec(g, dst) + ds.push(Attach{ + group: g, + Parent: parentID, + Key: parentKey, + Child: nodes.UniqueKey(dst), + }) + } else { + ds.push(Attach{ + group: g, + Parent: parentID, + Key: parentKey, + Child: nil, + }) + } + case match: + src, dst := src.(nodes.Object), dst.(nodes.Object) + + checkAndPush := func(key string) { + if _, ok := dst[key]; !ok { + ds.push(Detach{ + Parent: nodes.UniqueKey(src), + Key: String(key), + }) + } else if _, ok := src[key]; !ok { + g := ds.newGroup() + ds.createRec(g, dst[key]) + ds.push(Attach{ + group: g, + Parent: nodes.UniqueKey(src), + Key: String(key), + Child: nodes.UniqueKey(dst[key]), + }) + } else { + ds.generateDifference( + src[key], dst[key], nodes.UniqueKey(src), String(key)) + } + } + for _, key := range src.Keys() { + checkAndPush(key) + } + for _, key := range dst.Keys() { + if _, in := src[key]; !in { + checkAndPush(key) + } + } + case permute: + src, dst := src.(nodes.Array), dst.(nodes.Array) + l := len(dst) - len(src) + // add possible nils to src + if l > 0 { + arr := make(nodes.Array, len(dst)) + copy(arr, src) + src = arr + } + recreate := l != 0 + for i1, i2 := range d.permutation { + if i1 != i2 { + recreate = true + break + } + } + if recreate { + // recreate src with right perm + newsrc := make([]nodes.Node, 0, len(dst)) + for i := range dst { + newsrc = append(newsrc, src[d.permutation[i]]) + } + src = newsrc + g := ds.newGroup() + ds.push(Create{group: g, Node: src}) // TODO: not create, only mutate... + ds.push(Attach{ + group: g, + Parent: parentID, + Key: parentKey, + Child: nodes.UniqueKey(src), + }) + } + for i := 0; i < len(dst); i++ { + ds.generateDifference(src[i], dst[i], nodes.UniqueKey(src), Int(i)) + } + default: + panic(fmt.Errorf("unknown decision %v", d)) + } +} + +// Cost is a function that takes two trees: src and dst and returns number of operations +// needed to convert the former into the latter. +func Cost(src, dst nodes.Node) int { + ds := makeCacheStorage() + return ds.decideAction(src, dst).cost() +} + +// Changes is a function that takes two trees: src and dst and returns a changelist +// containing all operations required to convert the former into the latter. +func Changes(src, dst nodes.Node) Changelist { + ds := makeCacheStorage() + ds.generateDifference(src, dst, nil, Int(0)) + return ds.changes +} diff --git a/uast/diff/testdata/0_dst.uast b/uast/diff/testdata/0_dst.uast new file mode 100644 index 00000000..ba157e75 --- /dev/null +++ b/uast/diff/testdata/0_dst.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 2, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/0_src.uast b/uast/diff/testdata/0_src.uast new file mode 100644 index 00000000..99e9c673 --- /dev/null +++ b/uast/diff/testdata/0_src.uast @@ -0,0 +1,317 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "TryExcept", + '@role': [Catch, Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 4, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 4, + col: 13, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 103, + line: 4, + col: 42, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 4, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 126, + line: 4, + col: 65, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + kwargs: ~, + starargs: ~, + }, + }, + ], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 128, + line: 5, + col: 1, + }, + }, + '@token': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 146, + line: 5, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 20, + }, + }, + Name: "e", + }, + body: [ + { '@type': "Print", + '@token': "print", + '@role': [Call, Callee, Expression, Function, Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 153, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 158, + line: 6, + col: 10, + }, + }, + dest: ~, + nl: true, + values: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 6, + col: 22, + }, + }, + Format: "", + Value: "Error: %s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 6, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 6, + col: 26, + }, + }, + Name: "e", + }, + }, + ], + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 135, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 5, + col: 17, + }, + }, + Name: "Exception", + }, + }, + ], + orelse: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/100_dst.uast b/uast/diff/testdata/100_dst.uast new file mode 100644 index 00000000..be41e849 --- /dev/null +++ b/uast/diff/testdata/100_dst.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/100_src.uast b/uast/diff/testdata/100_src.uast new file mode 100644 index 00000000..fba81615 --- /dev/null +++ b/uast/diff/testdata/100_src.uast @@ -0,0 +1,1295 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 258, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 287, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 299, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 396, + line: 19, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 20, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 20, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 427, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 432, + line: 20, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 20, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 465, + line: 21, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 22, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 508, + line: 24, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 24, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 532, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 548, + line: 25, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 25, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 532, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 26, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 565, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 627, + line: 26, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 668, + line: 27, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 671, + line: 27, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 27, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 27, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 27, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 27, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 29, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 721, + line: 31, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 674, + line: 28, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 31, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 33, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 762, + line: 33, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 33, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 33, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 741, + line: 33, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 740, + line: 33, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 774, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 34, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 778, + line: 34, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 34, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 801, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 807, + line: 35, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 808, + line: 35, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 837, + line: 35, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 35, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 35, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 808, + line: 35, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 37, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 37, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 874, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 38, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 881, + line: 38, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 38, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 38, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 881, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 884, + line: 38, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/101_dst.uast b/uast/diff/testdata/101_dst.uast new file mode 100644 index 00000000..32b12d6e --- /dev/null +++ b/uast/diff/testdata/101_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.7", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 408, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 867, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1178, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1199, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1193, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/101_src.uast b/uast/diff/testdata/101_src.uast new file mode 100644 index 00000000..c98a99db --- /dev/null +++ b/uast/diff/testdata/101_src.uast @@ -0,0 +1,636 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 27, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 972, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 31, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1155, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1191, + line: 36, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1158, + line: 35, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1172, + line: 35, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/102_dst.uast b/uast/diff/testdata/102_dst.uast new file mode 100644 index 00000000..8bd55a0a --- /dev/null +++ b/uast/diff/testdata/102_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.7-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/102_src.uast b/uast/diff/testdata/102_src.uast new file mode 100644 index 00000000..32b12d6e --- /dev/null +++ b/uast/diff/testdata/102_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.7", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 408, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 867, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1178, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1199, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1193, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/103_dst.uast b/uast/diff/testdata/103_dst.uast new file mode 100644 index 00000000..32b12d6e --- /dev/null +++ b/uast/diff/testdata/103_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.7", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 408, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 867, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1178, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1199, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1193, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/103_src.uast b/uast/diff/testdata/103_src.uast new file mode 100644 index 00000000..8bd55a0a --- /dev/null +++ b/uast/diff/testdata/103_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.7-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/104_dst.uast b/uast/diff/testdata/104_dst.uast new file mode 100644 index 00000000..9a42a9f4 --- /dev/null +++ b/uast/diff/testdata/104_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/104_src.uast b/uast/diff/testdata/104_src.uast new file mode 100644 index 00000000..32b12d6e --- /dev/null +++ b/uast/diff/testdata/104_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.7", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 408, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 867, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1178, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1199, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1193, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/105_dst.uast b/uast/diff/testdata/105_dst.uast new file mode 100644 index 00000000..efee53e4 --- /dev/null +++ b/uast/diff/testdata/105_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 282, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "0.7.1-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 527, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 802, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 891, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 999, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1184, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1185, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/105_src.uast b/uast/diff/testdata/105_src.uast new file mode 100644 index 00000000..9a42a9f4 --- /dev/null +++ b/uast/diff/testdata/105_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/106_dst.uast b/uast/diff/testdata/106_dst.uast new file mode 100644 index 00000000..9a42a9f4 --- /dev/null +++ b/uast/diff/testdata/106_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/106_src.uast b/uast/diff/testdata/106_src.uast new file mode 100644 index 00000000..efee53e4 --- /dev/null +++ b/uast/diff/testdata/106_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 282, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "0.7.1-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 527, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 802, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 891, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 999, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1184, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1185, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/107_dst.uast b/uast/diff/testdata/107_dst.uast new file mode 100644 index 00000000..b14c76c5 --- /dev/null +++ b/uast/diff/testdata/107_dst.uast @@ -0,0 +1,652 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/107_src.uast b/uast/diff/testdata/107_src.uast new file mode 100644 index 00000000..9a42a9f4 --- /dev/null +++ b/uast/diff/testdata/107_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/108_dst.uast b/uast/diff/testdata/108_dst.uast new file mode 100644 index 00000000..430234cc --- /dev/null +++ b/uast/diff/testdata/108_dst.uast @@ -0,0 +1,1625 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 30, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 30, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 30, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 30, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 31, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 31, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 31, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 31, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 31, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 32, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 32, + col: 44, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 32, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 899, + line: 32, + col: 64, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 32, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 32, + col: 53, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 32, + col: 51, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 32, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 32, + col: 47, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 32, + col: 40, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 926, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 938, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 977, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 976, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 959, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1026, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/108_src.uast b/uast/diff/testdata/108_src.uast new file mode 100644 index 00000000..148104ed --- /dev/null +++ b/uast/diff/testdata/108_src.uast @@ -0,0 +1,1578 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 758, + line: 30, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 30, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 778, + line: 30, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 782, + line: 30, + col: 43, + }, + }, + Format: "", + Value: "42", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 30, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 30, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 30, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 768, + line: 30, + col: 29, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 761, + line: 30, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 30, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 30, + col: 21, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 30, + col: 20, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 30, + col: 20, + }, + }, + Name: "data", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 795, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 31, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 31, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 814, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 31, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 31, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 27, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 23, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 835, + line: 32, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 32, + col: 44, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 32, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 879, + line: 32, + col: 64, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 32, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 32, + col: 53, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 32, + col: 51, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 32, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 862, + line: 32, + col: 47, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 835, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 40, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 893, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 906, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 918, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 967, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 987, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 957, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 956, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1000, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/109_dst.uast b/uast/diff/testdata/109_dst.uast new file mode 100644 index 00000000..000a5f08 --- /dev/null +++ b/uast/diff/testdata/109_dst.uast @@ -0,0 +1,1674 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 30, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 30, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 30, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 30, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 31, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 31, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 31, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 31, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 31, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 32, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 893, + line: 32, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 32, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 32, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 32, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 32, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 853, + line: 32, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 32, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 933, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 962, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1027, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/109_src.uast b/uast/diff/testdata/109_src.uast new file mode 100644 index 00000000..430234cc --- /dev/null +++ b/uast/diff/testdata/109_src.uast @@ -0,0 +1,1625 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 30, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 30, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 30, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 30, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 31, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 31, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 31, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 31, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 31, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 32, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 32, + col: 44, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 32, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 899, + line: 32, + col: 64, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 32, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 32, + col: 53, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 32, + col: 51, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 32, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 32, + col: 47, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 32, + col: 40, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 926, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 938, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 977, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 976, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 959, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 954, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1026, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/10_dst.uast b/uast/diff/testdata/10_dst.uast new file mode 100644 index 00000000..8275baeb --- /dev/null +++ b/uast/diff/testdata/10_dst.uast @@ -0,0 +1,398 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "sys", + }, + Node: {}, + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 20, + line: 1, + col: 21, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + Block: false, + Prefix: "!/", + Suffix: "\n", + Tab: "", + Text: "usr/bin/env python", + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + args: [ + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 53, + line: 3, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 18, + }, + }, + }, + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 88, + line: 3, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 3, + col: 60, + }, + }, + Name: "__file__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 3, + col: 39, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 3, + col: 38, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 75, + line: 3, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 3, + col: 43, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + }, + Name: "dirname", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 3, + col: 22, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 27, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + }, + Name: "abspath", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 38, + line: 3, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 41, + line: 3, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 40, + line: 3, + col: 4, + }, + }, + Name: "sys", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 41, + line: 3, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 9, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + Name: "insert", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 4, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 137, + line: 5, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/10_src.uast b/uast/diff/testdata/10_src.uast new file mode 100644 index 00000000..4c15dc9b --- /dev/null +++ b/uast/diff/testdata/10_src.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/110_dst.uast b/uast/diff/testdata/110_dst.uast new file mode 100644 index 00000000..2d1e7128 --- /dev/null +++ b/uast/diff/testdata/110_dst.uast @@ -0,0 +1,1719 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 379, + line: 19, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 19, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 21, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 457, + line: 22, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 22, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 22, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 22, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 23, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 506, + line: 23, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 24, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 24, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 27, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 28, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 30, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 30, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 30, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 30, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 30, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 763, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 32, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 32, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 33, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 33, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 831, + line: 33, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 33, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 33, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 34, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 34, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 34, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 34, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 34, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 34, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 34, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 35, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 35, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 35, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 934, + line: 35, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 35, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 35, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 921, + line: 35, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 893, + line: 35, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 595, + line: 26, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 26, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 39, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 977, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 39, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 39, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 40, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1054, + line: 40, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 40, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 40, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1023, + line: 40, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1002, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 40, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 41, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1068, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1073, + line: 41, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/110_src.uast b/uast/diff/testdata/110_src.uast new file mode 100644 index 00000000..000a5f08 --- /dev/null +++ b/uast/diff/testdata/110_src.uast @@ -0,0 +1,1674 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 30, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 30, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 30, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 30, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 31, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 31, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 31, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 31, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 31, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 32, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 893, + line: 32, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 32, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 32, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 32, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 32, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 853, + line: 32, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 32, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 933, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 962, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1027, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/111_dst.uast b/uast/diff/testdata/111_dst.uast new file mode 100644 index 00000000..434581b5 --- /dev/null +++ b/uast/diff/testdata/111_dst.uast @@ -0,0 +1,3016 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 212, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.appctx\n ~~~~~~~~~~~~~~~~~~~~~~\n\n Tests the application context.\n\n :copyright: (c) 2012 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "AppContextTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 19, + col: 25, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 354, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 39, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 34, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_basic_url_generation", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 22, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 22, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 22, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 22, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 446, + line: 22, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 427, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 432, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 22, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 22, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 23, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 23, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 23, + col: 33, + }, + }, + Format: "", + Value: "SERVER_NAME", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 23, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 23, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 23, + col: 9, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 23, + col: 48, + }, + }, + Format: "", + Value: "localhost", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 24, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 537, + line: 24, + col: 42, + }, + }, + Format: "", + Value: "PREFERRED_URL_SCHEME", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 508, + line: 24, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 507, + line: 24, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 9, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 24, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 548, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "https", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 26, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 611, + line: 28, + col: 17, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 25, + col: 1, + }, + }, + lines: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 30, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 31, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 31, + col: 15, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 31, + col: 18, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 683, + line: 31, + col: 39, + }, + }, + Format: "", + Value: "index", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 663, + line: 31, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 31, + col: 24, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 31, + col: 23, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 31, + col: 18, + }, + }, + Name: "url_for", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 32, + col: 33, + }, + }, + Name: "rv", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 32, + col: 55, + }, + }, + Format: "", + Value: "https://localhost/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 702, + line: 32, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 32, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 30, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 627, + line: 30, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 630, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 30, + col: 17, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 30, + col: 14, + }, + }, + Name: "app_context", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 21, + col: 39, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 21, + col: 39, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 790, + line: 34, + col: 49, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_url_generation_requires_server_name", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 35, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 35, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 35, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 35, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 813, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 818, + line: 35, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 35, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 817, + line: 35, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 35, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 36, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 36, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 878, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 37, + col: 17, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 38, + col: 17, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 38, + col: 17, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 947, + line: 38, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 38, + col: 38, + }, + }, + Format: "", + Value: "index", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 38, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 38, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 38, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 938, + line: 38, + col: 22, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 38, + col: 17, + }, + }, + Name: "url_for", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 37, + col: 18, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 37, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 37, + col: 49, + }, + }, + Name: "RuntimeError", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 884, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 37, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 37, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 887, + line: 37, + col: 22, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 37, + col: 18, + }, + }, + Name: "assert_raises", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 36, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 36, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 36, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 36, + col: 17, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 36, + col: 14, + }, + }, + Name: "app_context", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 795, + line: 34, + col: 54, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 795, + line: 34, + col: 54, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 40, + col: 50, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_url_generation_without_context_fails", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1022, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1026, + line: 41, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 42, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 42, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1087, + line: 42, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1094, + line: 42, + col: 34, + }, + }, + Format: "", + Value: "index", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1074, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1079, + line: 42, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1078, + line: 42, + col: 18, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 42, + col: 13, + }, + }, + Name: "url_for", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 41, + col: 14, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1046, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 41, + col: 45, + }, + }, + Name: "RuntimeError", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1032, + line: 41, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 41, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1031, + line: 41, + col: 18, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 41, + col: 14, + }, + }, + Name: "assert_raises", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 40, + col: 55, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 40, + col: 55, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1105, + line: 44, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1143, + line: 44, + col: 47, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_context_means_app_context", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1159, + line: 45, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1159, + line: 45, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1162, + line: 45, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 45, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1177, + line: 45, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1185, + line: 45, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1166, + line: 45, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1171, + line: 45, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 45, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1170, + line: 45, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 45, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1195, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 46, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 47, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 47, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 47, + col: 31, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 47, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 47, + col: 37, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 47, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1263, + line: 47, + col: 36, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1264, + line: 47, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1275, + line: 47, + col: 48, + }, + }, + Name: "current_app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 47, + col: 31, + }, + }, + Name: "_get_current_object", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1299, + line: 47, + col: 72, + }, + end: { '@type': "uast:Position", + offset: 1302, + line: 47, + col: 75, + }, + }, + Name: "app", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1241, + line: 47, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 47, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1244, + line: 47, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 47, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 46, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 46, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1204, + line: 46, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 46, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1203, + line: 46, + col: 17, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 46, + col: 14, + }, + }, + Name: "test_request_context", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1312, + line: 48, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1312, + line: 48, + col: 9, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 48, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 48, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 48, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1335, + line: 48, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 48, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1350, + line: 48, + col: 47, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 48, + col: 27, + }, + }, + Name: "top", + }, + ], + }, + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Argument, Call, Expression, Function, Literal, Name, 'Null', Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1356, + line: 48, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1360, + line: 48, + col: 57, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1313, + line: 48, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1317, + line: 48, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1312, + line: 48, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 48, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1312, + line: 48, + col: 9, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 44, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 1148, + line: 44, + col: 52, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 44, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 1148, + line: 44, + col: 52, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1371, + line: 50, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1408, + line: 50, + col: 46, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_app_context_provides_current_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1424, + line: 51, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1424, + line: 51, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1427, + line: 51, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1430, + line: 51, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1442, + line: 51, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1450, + line: 51, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1431, + line: 51, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1436, + line: 51, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1430, + line: 51, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1435, + line: 51, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1430, + line: 51, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1460, + line: 52, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1464, + line: 52, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1496, + line: 53, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1496, + line: 53, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1514, + line: 53, + col: 31, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1515, + line: 53, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1520, + line: 53, + col: 37, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1514, + line: 53, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1519, + line: 53, + col: 36, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1520, + line: 53, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1531, + line: 53, + col: 48, + }, + }, + Name: "current_app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1514, + line: 53, + col: 31, + }, + }, + Name: "_get_current_object", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1555, + line: 53, + col: 72, + }, + end: { '@type': "uast:Position", + offset: 1558, + line: 53, + col: 75, + }, + }, + Name: "app", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1497, + line: 53, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1501, + line: 53, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1496, + line: 53, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1500, + line: 53, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1496, + line: 53, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1465, + line: 52, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1466, + line: 52, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1469, + line: 52, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1465, + line: 52, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1468, + line: 52, + col: 17, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1465, + line: 52, + col: 14, + }, + }, + Name: "app_context", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1568, + line: 54, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1568, + line: 54, + col: 9, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1587, + line: 54, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1592, + line: 54, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1586, + line: 54, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1591, + line: 54, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1592, + line: 54, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1606, + line: 54, + col: 47, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1586, + line: 54, + col: 27, + }, + }, + Name: "top", + }, + ], + }, + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Argument, Call, Expression, Function, Literal, Name, 'Null', Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1612, + line: 54, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1616, + line: 54, + col: 57, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1569, + line: 54, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1573, + line: 54, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1568, + line: 54, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1572, + line: 54, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1568, + line: 54, + col: 9, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1409, + line: 50, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1413, + line: 50, + col: 51, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1409, + line: 50, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1413, + line: 50, + col: 51, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1624, + line: 57, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1629, + line: 57, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1637, + line: 58, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1637, + line: 58, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1642, + line: 58, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1645, + line: 58, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1646, + line: 58, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1654, + line: 58, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1645, + line: 58, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1653, + line: 58, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1645, + line: 58, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1670, + line: 59, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1670, + line: 59, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1684, + line: 59, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1703, + line: 59, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1721, + line: 59, + col: 56, + }, + }, + Name: "AppContextTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1685, + line: 59, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1693, + line: 59, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1684, + line: 59, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1692, + line: 59, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1684, + line: 59, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1671, + line: 59, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1676, + line: 59, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1670, + line: 59, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1675, + line: 59, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1670, + line: 59, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1728, + line: 60, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1734, + line: 60, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1735, + line: 60, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1740, + line: 60, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/111_src.uast b/uast/diff/testdata/111_src.uast new file mode 100644 index 00000000..860efb8b --- /dev/null +++ b/uast/diff/testdata/111_src.uast @@ -0,0 +1,1217 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 212, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.appctx\n ~~~~~~~~~~~~~~~~~~~~~~\n\n Tests the application context.\n\n :copyright: (c) 2012 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "AppContextTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 19, + col: 25, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 354, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 39, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 21, + col: 27, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_basic_support", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 22, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 22, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 431, + line: 22, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 22, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 22, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 22, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 23, + col: 33, + }, + }, + Format: "", + Value: "SERVER_NAME", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 23, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 23, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 9, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 23, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 23, + col: 48, + }, + }, + Format: "", + Value: "localhost", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 24, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 42, + }, + }, + Format: "", + Value: "PREFERRED_URL_SCHEME", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 24, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 501, + line: 24, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 9, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "https", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 26, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 28, + col: 17, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 25, + col: 1, + }, + }, + lines: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 618, + line: 30, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 31, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 31, + col: 15, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 31, + col: 18, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 676, + line: 31, + col: 39, + }, + }, + Format: "", + Value: "index", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 656, + line: 31, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 661, + line: 31, + col: 24, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 660, + line: 31, + col: 23, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 31, + col: 18, + }, + }, + Name: "url_for", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 690, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 690, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 710, + line: 32, + col: 33, + }, + }, + Name: "rv", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 55, + }, + }, + Format: "", + Value: "https://localhost/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 32, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 690, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 32, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 690, + line: 32, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 30, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 30, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 30, + col: 17, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 30, + col: 14, + }, + }, + Name: "app_context", + }, + ], + }, + keywords: [], + }, + 'optional_vars': ~, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 21, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 21, + col: 32, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 758, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 819, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 37, + col: 56, + }, + }, + Name: "AppContextTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 801, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 808, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 844, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 856, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/112_dst.uast b/uast/diff/testdata/112_dst.uast new file mode 100644 index 00000000..0e24d942 --- /dev/null +++ b/uast/diff/testdata/112_dst.uast @@ -0,0 +1,1430 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "pytest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 283, + line: 17, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 17, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 318, + line: 18, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 19, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 465, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 23, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 23, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 501, + line: 23, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 23, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 505, + line: 23, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 23, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 23, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 24, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 24, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 24, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 557, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 27, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 593, + line: 27, + col: 24, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 27, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 27, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 45, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 27, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 78, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 28, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 687, + line: 28, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 658, + line: 28, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 664, + line: 28, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 28, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 789, + line: 31, + col: 43, + }, + }, + Format: "", + Value: "Request.module is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 799, + line: 33, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 35, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 35, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 48, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 35, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 35, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 35, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + Name: "module", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 36, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 36, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 38, + col: 23, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 38, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 923, + line: 38, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 39, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 39, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 949, + line: 39, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 39, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/112_src.uast b/uast/diff/testdata/112_src.uast new file mode 100644 index 00000000..c3a8d502 --- /dev/null +++ b/uast/diff/testdata/112_src.uast @@ -0,0 +1,1996 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "pytest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 283, + line: 17, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 17, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 19, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 20, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 395, + line: 20, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 21, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 422, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 21, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 21, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 21, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 21, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 22, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 22, + col: 13, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 22, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + }, + Name: "testing", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 468, + line: 24, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 26, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 26, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 565, + line: 26, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 26, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 26, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 26, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 543, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 548, + line: 26, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 547, + line: 26, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 548, + line: 26, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 26, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 596, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 27, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 595, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 27, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 595, + line: 27, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 594, + line: 27, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 627, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 634, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 638, + line: 28, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 30, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 31, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 31, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 31, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 31, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 32, + col: 23, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 32, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 32, + col: 44, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 77, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 30, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 30, + col: 40, + }, + }, + Name: "catch_deprecation_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 685, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 30, + col: 54, + }, + }, + Name: "captured", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 822, + line: 34, + col: 15, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 34, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 34, + col: 34, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 34, + col: 28, + }, + }, + Name: "captured", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 19, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 19, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 19, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 19, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 19, + col: 59, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 19, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 19, + col: 59, + }, + }, + Name: "catch_deprecation_warnings", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 36, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 36, + col: 28, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 37, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 37, + col: 43, + }, + }, + Format: "", + Value: "Request.module is deprecated", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 38, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 38, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 38, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 964, + line: 38, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 39, + col: 13, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 39, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + }, + Name: "testing", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 39, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 39, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 41, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 43, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1101, + line: 43, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 43, + col: 48, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 43, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 43, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 43, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1083, + line: 43, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1090, + line: 43, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + }, + Name: "module", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1124, + line: 44, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1125, + line: 44, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1129, + line: 44, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1139, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1143, + line: 46, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1198, + line: 47, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1198, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 47, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 47, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1206, + line: 47, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 47, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 48, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1241, + line: 48, + col: 22, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 48, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1234, + line: 48, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 48, + col: 14, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 46, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 46, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1170, + line: 46, + col: 40, + }, + }, + Name: "catch_deprecation_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 46, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 1184, + line: 46, + col: 54, + }, + }, + Name: "captured", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1252, + line: 50, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 50, + col: 15, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1276, + line: 50, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 50, + col: 34, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1263, + line: 50, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1271, + line: 50, + col: 28, + }, + }, + Name: "captured", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 50, + col: 19, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 871, + line: 36, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 36, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 871, + line: 36, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 36, + col: 33, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 877, + line: 36, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 61, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 877, + line: 36, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 61, + }, + }, + Name: "catch_deprecation_warnings", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/113_dst.uast b/uast/diff/testdata/113_dst.uast new file mode 100644 index 00000000..a7eae88a --- /dev/null +++ b/uast/diff/testdata/113_dst.uast @@ -0,0 +1,843 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 15, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 15, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 16, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 17, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 21, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 21, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 21, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 21, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 21, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 21, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 462, + line: 21, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 21, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 22, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 22, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 510, + line: 22, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 515, + line: 22, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 516, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 523, + line: 22, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 510, + line: 22, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 22, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 548, + line: 23, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 23, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 575, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 578, + line: 25, + col: 24, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 25, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 632, + line: 25, + col: 78, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 643, + line: 26, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 650, + line: 26, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 649, + line: 26, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 16, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 16, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 16, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 16, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 40, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 45, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 45, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 16, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 53, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 16, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 53, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/113_src.uast b/uast/diff/testdata/113_src.uast new file mode 100644 index 00000000..0e24d942 --- /dev/null +++ b/uast/diff/testdata/113_src.uast @@ -0,0 +1,1430 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "pytest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 283, + line: 17, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 17, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 318, + line: 18, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 19, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 465, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 23, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 23, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 501, + line: 23, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 23, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 505, + line: 23, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 23, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 23, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 24, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 24, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 24, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 557, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 27, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 593, + line: 27, + col: 24, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 27, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 27, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 45, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 27, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 78, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 28, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 687, + line: 28, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 658, + line: 28, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 664, + line: 28, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 28, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 789, + line: 31, + col: 43, + }, + }, + Format: "", + Value: "Request.module is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 799, + line: 33, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 35, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 35, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 48, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 35, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 35, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 35, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + Name: "module", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 36, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 36, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 38, + col: 23, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 38, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 923, + line: 38, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 39, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 39, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 949, + line: 39, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 39, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/114_dst.uast b/uast/diff/testdata/114_dst.uast new file mode 100644 index 00000000..b8137c85 --- /dev/null +++ b/uast/diff/testdata/114_dst.uast @@ -0,0 +1,1673 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 13, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 16, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 376, + line: 16, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 21, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 21, + col: 8, + }, + }, + Format: "", + Value: "Works like a regular Werkzeug test client but has some\n knowledge about how Flask works to defer the cleanup of the\n request context stack to the end of a with body when used\n in a with statement.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 23, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 23, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 23, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 23, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 649, + line: 23, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 659, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 696, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 698, + line: 26, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 27, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 753, + line: 27, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 28, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 28, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 776, + line: 28, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 28, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 704, + line: 26, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 26, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 30, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 29, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 848, + line: 29, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 850, + line: 29, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 29, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 817, + line: 29, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 30, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 30, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 31, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 31, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 31, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 31, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 982, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 988, + line: 33, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 33, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 33, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 33, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 33, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 33, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 33, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 33, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1022, + line: 33, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 35, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1057, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 35, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 1111, + line: 35, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 35, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1097, + line: 35, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 35, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1130, + line: 37, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1170, + line: 38, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1174, + line: 38, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 39, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1190, + line: 39, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1194, + line: 39, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 41, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 42, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 42, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1277, + line: 42, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 42, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1291, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1293, + line: 43, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 44, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 44, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1348, + line: 44, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 43, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1298, + line: 43, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/114_src.uast b/uast/diff/testdata/114_src.uast new file mode 100644 index 00000000..faadd6b4 --- /dev/null +++ b/uast/diff/testdata/114_src.uast @@ -0,0 +1,1647 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 13, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 16, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 376, + line: 16, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 400, + line: 18, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 420, + line: 18, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 423, + line: 18, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 20, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 475, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 21, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 22, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 532, + line: 22, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 23, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 23, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 21, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 21, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 21, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 25, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 627, + line: 24, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 24, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 597, + line: 24, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 596, + line: 24, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 25, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 681, + line: 25, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 25, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 26, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 710, + line: 26, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 26, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 26, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 747, + line: 27, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 28, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 784, + line: 28, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 28, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 28, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 28, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 774, + line: 28, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 795, + line: 28, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 28, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 30, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 30, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 30, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 858, + line: 30, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 876, + line: 30, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 30, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 20, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 20, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 32, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 33, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 930, + line: 33, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 33, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 33, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 962, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 34, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 34, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 34, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 32, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 32, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 32, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 32, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 36, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 36, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1033, + line: 37, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 37, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1036, + line: 37, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1056, + line: 37, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1072, + line: 38, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1128, + line: 39, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1127, + line: 39, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1074, + line: 38, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1078, + line: 38, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1077, + line: 38, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 38, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 36, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 36, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 36, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 36, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 998, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 36, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 998, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 36, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 36, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1017, + line: 36, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 36, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1017, + line: 36, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 36, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 36, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/115_dst.uast b/uast/diff/testdata/115_dst.uast new file mode 100644 index 00000000..824fef1c --- /dev/null +++ b/uast/diff/testdata/115_dst.uast @@ -0,0 +1,683 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1252, + line: 40, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/115_src.uast b/uast/diff/testdata/115_src.uast new file mode 100644 index 00000000..b14c76c5 --- /dev/null +++ b/uast/diff/testdata/115_src.uast @@ -0,0 +1,652 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/116_dst.uast b/uast/diff/testdata/116_dst.uast new file mode 100644 index 00000000..1271a617 --- /dev/null +++ b/uast/diff/testdata/116_dst.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/116_src.uast b/uast/diff/testdata/116_src.uast new file mode 100644 index 00000000..824fef1c --- /dev/null +++ b/uast/diff/testdata/116_src.uast @@ -0,0 +1,683 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1252, + line: 40, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/117_dst.uast b/uast/diff/testdata/117_dst.uast new file mode 100644 index 00000000..68a328b4 --- /dev/null +++ b/uast/diff/testdata/117_dst.uast @@ -0,0 +1,497 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 354, + line: 17, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 385, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "not used currently", + }, + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 21, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 410, + line: 22, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 22, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 22, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 23, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 453, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 23, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 23, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 23, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 23, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 510, + line: 24, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/117_src.uast b/uast/diff/testdata/117_src.uast new file mode 100644 index 00000000..2d1e7128 --- /dev/null +++ b/uast/diff/testdata/117_src.uast @@ -0,0 +1,1719 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 379, + line: 19, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 19, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 21, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 457, + line: 22, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 22, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 22, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 22, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 23, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 506, + line: 23, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 24, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 24, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 27, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 28, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 30, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 30, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 30, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 30, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 30, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 763, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 32, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 32, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 33, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 33, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 831, + line: 33, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 33, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 33, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 34, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 34, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 34, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 34, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 34, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 34, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 34, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 35, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 35, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 35, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 934, + line: 35, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 35, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 35, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 921, + line: 35, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 893, + line: 35, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 595, + line: 26, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 26, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 39, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 977, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 39, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 39, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 40, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1054, + line: 40, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 40, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 40, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1023, + line: 40, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1002, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 40, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 41, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1068, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1073, + line: 41, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/118_dst.uast b/uast/diff/testdata/118_dst.uast new file mode 100644 index 00000000..1271a617 --- /dev/null +++ b/uast/diff/testdata/118_dst.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/118_src.uast b/uast/diff/testdata/118_src.uast new file mode 100644 index 00000000..824fef1c --- /dev/null +++ b/uast/diff/testdata/118_src.uast @@ -0,0 +1,683 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1252, + line: 40, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/119_dst.uast b/uast/diff/testdata/119_dst.uast new file mode 100644 index 00000000..b7d2928b --- /dev/null +++ b/uast/diff/testdata/119_dst.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/119_src.uast b/uast/diff/testdata/119_src.uast new file mode 100644 index 00000000..1271a617 --- /dev/null +++ b/uast/diff/testdata/119_src.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/11_dst.uast b/uast/diff/testdata/11_dst.uast new file mode 100644 index 00000000..99e9c673 --- /dev/null +++ b/uast/diff/testdata/11_dst.uast @@ -0,0 +1,317 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "TryExcept", + '@role': [Catch, Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 4, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 4, + col: 13, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 103, + line: 4, + col: 42, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 4, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 126, + line: 4, + col: 65, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + kwargs: ~, + starargs: ~, + }, + }, + ], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 128, + line: 5, + col: 1, + }, + }, + '@token': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 146, + line: 5, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 20, + }, + }, + Name: "e", + }, + body: [ + { '@type': "Print", + '@token': "print", + '@role': [Call, Callee, Expression, Function, Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 153, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 158, + line: 6, + col: 10, + }, + }, + dest: ~, + nl: true, + values: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 6, + col: 22, + }, + }, + Format: "", + Value: "Error: %s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 6, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 6, + col: 26, + }, + }, + Name: "e", + }, + }, + ], + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 135, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 5, + col: 17, + }, + }, + Name: "Exception", + }, + }, + ], + orelse: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/11_src.uast b/uast/diff/testdata/11_src.uast new file mode 100644 index 00000000..5e167c2e --- /dev/null +++ b/uast/diff/testdata/11_src.uast @@ -0,0 +1,187 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 58, + line: 3, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 10, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 65, + line: 3, + col: 9, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 38, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 3, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 117, + line: 3, + col: 61, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/120_dst.uast b/uast/diff/testdata/120_dst.uast new file mode 100644 index 00000000..2d1e7128 --- /dev/null +++ b/uast/diff/testdata/120_dst.uast @@ -0,0 +1,1719 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 379, + line: 19, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 19, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 21, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 457, + line: 22, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 22, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 22, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 22, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 23, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 506, + line: 23, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 24, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 24, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 27, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 28, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 30, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 30, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 30, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 30, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 30, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 763, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 32, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 32, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 33, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 33, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 831, + line: 33, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 33, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 33, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 34, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 34, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 34, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 34, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 34, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 34, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 34, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 35, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 35, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 35, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 934, + line: 35, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 35, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 35, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 921, + line: 35, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 893, + line: 35, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 595, + line: 26, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 26, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 39, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 977, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 39, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 39, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 40, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1054, + line: 40, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 40, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 40, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1023, + line: 40, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1002, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 40, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 41, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1068, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1073, + line: 41, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/120_src.uast b/uast/diff/testdata/120_src.uast new file mode 100644 index 00000000..000a5f08 --- /dev/null +++ b/uast/diff/testdata/120_src.uast @@ -0,0 +1,1674 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 16, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 16, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 353, + line: 16, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 365, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 19, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 423, + line: 19, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 20, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 21, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 21, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 21, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 526, + line: 21, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 23, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 24, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 27, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 27, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 27, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 27, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 27, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 29, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 29, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 29, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 29, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 30, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 30, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 30, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 30, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 30, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 30, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 30, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 31, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 31, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 31, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 31, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 31, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 31, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 31, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 31, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 32, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 893, + line: 32, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 32, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 32, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 32, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 32, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 32, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 32, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 32, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 853, + line: 32, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 32, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 32, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 23, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 23, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 18, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 35, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 933, + line: 36, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 36, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 36, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 36, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 37, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 37, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 37, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 37, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 962, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 37, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 37, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 961, + line: 37, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1027, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/121_dst.uast b/uast/diff/testdata/121_dst.uast new file mode 100644 index 00000000..807bf1ae --- /dev/null +++ b/uast/diff/testdata/121_dst.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.8", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 586, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 763, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 904, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1184, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1186, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1220, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1201, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1285, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/121_src.uast b/uast/diff/testdata/121_src.uast new file mode 100644 index 00000000..b7d2928b --- /dev/null +++ b/uast/diff/testdata/121_src.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/122_dst.uast b/uast/diff/testdata/122_dst.uast new file mode 100644 index 00000000..2eeac0e7 --- /dev/null +++ b/uast/diff/testdata/122_dst.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/122_src.uast b/uast/diff/testdata/122_src.uast new file mode 100644 index 00000000..807bf1ae --- /dev/null +++ b/uast/diff/testdata/122_src.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.8", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 586, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 763, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 904, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1184, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1186, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1220, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1201, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1285, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/123_dst.uast b/uast/diff/testdata/123_dst.uast new file mode 100644 index 00000000..58257bff --- /dev/null +++ b/uast/diff/testdata/123_dst.uast @@ -0,0 +1,702 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 900, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 965, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1041, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1247, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1214, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/123_src.uast b/uast/diff/testdata/123_src.uast new file mode 100644 index 00000000..2eeac0e7 --- /dev/null +++ b/uast/diff/testdata/123_src.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/124_dst.uast b/uast/diff/testdata/124_dst.uast new file mode 100644 index 00000000..24e002f6 --- /dev/null +++ b/uast/diff/testdata/124_dst.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/124_src.uast b/uast/diff/testdata/124_src.uast new file mode 100644 index 00000000..b09f4b31 --- /dev/null +++ b/uast/diff/testdata/124_src.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/125_dst.uast b/uast/diff/testdata/125_dst.uast new file mode 100644 index 00000000..13751a15 --- /dev/null +++ b/uast/diff/testdata/125_dst.uast @@ -0,0 +1,1448 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Logger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 25, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 27, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 27, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 27, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 27, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 27, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 29, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 831, + line: 29, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 29, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 863, + line: 30, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 31, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 916, + line: 31, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 31, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 31, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 31, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 925, + line: 31, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 31, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 33, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 34, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 34, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1038, + line: 35, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 35, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 35, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 36, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1081, + line: 36, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 36, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 36, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1208, + line: 39, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 39, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1215, + line: 39, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 40, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 40, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 40, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1274, + line: 41, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1273, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/125_src.uast b/uast/diff/testdata/125_src.uast new file mode 100644 index 00000000..f998e04f --- /dev/null +++ b/uast/diff/testdata/125_src.uast @@ -0,0 +1,1448 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Logger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 328, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 663, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 352, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 25, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 25, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 756, + line: 27, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 756, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 761, + line: 27, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 805, + line: 27, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 27, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 27, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 27, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 27, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 26, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 26, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 819, + line: 29, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 831, + line: 29, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 845, + line: 29, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 860, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 31, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 31, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 31, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 31, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 923, + line: 31, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 926, + line: 31, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 31, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 925, + line: 31, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 31, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 30, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 30, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 30, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 30, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 947, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 947, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 33, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 33, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 33, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 998, + line: 34, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 977, + line: 34, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1025, + line: 35, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1036, + line: 35, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1039, + line: 35, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1038, + line: 35, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1025, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 36, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 36, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 36, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1081, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 36, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1081, + line: 36, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1206, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 39, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 39, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1240, + line: 40, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 40, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1252, + line: 40, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1263, + line: 40, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1269, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1274, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1299, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 342, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 342, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/126_dst.uast b/uast/diff/testdata/126_dst.uast new file mode 100644 index 00000000..914db487 --- /dev/null +++ b/uast/diff/testdata/126_dst.uast @@ -0,0 +1,1504 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 28, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 28, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 28, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 28, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 28, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 28, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 28, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 28, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 30, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 32, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 32, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 32, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 978, + line: 32, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 32, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 963, + line: 32, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 32, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1030, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 36, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 36, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1075, + line: 36, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1049, + line: 36, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1048, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 37, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 37, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1122, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 37, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1243, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 40, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 40, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 40, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 40, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 41, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1276, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 41, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1323, + line: 42, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1343, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 43, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/126_src.uast b/uast/diff/testdata/126_src.uast new file mode 100644 index 00000000..13751a15 --- /dev/null +++ b/uast/diff/testdata/126_src.uast @@ -0,0 +1,1448 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Logger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 25, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 27, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 27, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 27, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 27, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 27, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 29, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 831, + line: 29, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 29, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 863, + line: 30, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 31, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 916, + line: 31, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 31, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 31, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 31, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 925, + line: 31, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 31, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 33, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 34, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 34, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1038, + line: 35, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 35, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 35, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 36, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1081, + line: 36, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 36, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 36, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1208, + line: 39, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 39, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1215, + line: 39, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 40, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 40, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 40, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1274, + line: 41, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1273, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/127_dst.uast b/uast/diff/testdata/127_dst.uast new file mode 100644 index 00000000..426aa4b3 --- /dev/null +++ b/uast/diff/testdata/127_dst.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/127_src.uast b/uast/diff/testdata/127_src.uast new file mode 100644 index 00000000..fba6d60a --- /dev/null +++ b/uast/diff/testdata/127_src.uast @@ -0,0 +1,1494 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_PackageBoundObject", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_endpoint_from_view_func", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 314, + line: 15, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 357, + line: 18, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 436, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 468, + line: 23, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 23, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 475, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 31, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 31, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 872, + line: 33, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 980, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 35, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1009, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1015, + line: 36, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1036, + line: 36, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1023, + line: 36, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 36, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 38, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 38, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1166, + line: 38, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1162, + line: 38, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1139, + line: 38, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 991, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 35, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 987, + line: 35, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1195, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 39, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 39, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 39, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 39, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1177, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1186, + line: 39, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1185, + line: 39, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1220, + line: 39, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 39, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 40, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1279, + line: 40, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1300, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1302, + line: 42, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1371, + line: 43, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1375, + line: 43, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1374, + line: 43, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1392, + line: 43, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1400, + line: 43, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 42, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1335, + line: 42, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1334, + line: 42, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1346, + line: 42, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 42, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1319, + line: 42, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1324, + line: 42, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1310, + line: 42, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 33, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 33, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 918, + line: 33, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 34, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 34, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/128_dst.uast b/uast/diff/testdata/128_dst.uast new file mode 100644 index 00000000..b09f4b31 --- /dev/null +++ b/uast/diff/testdata/128_dst.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/128_src.uast b/uast/diff/testdata/128_src.uast new file mode 100644 index 00000000..426aa4b3 --- /dev/null +++ b/uast/diff/testdata/128_src.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/129_dst.uast b/uast/diff/testdata/129_dst.uast new file mode 100644 index 00000000..58257bff --- /dev/null +++ b/uast/diff/testdata/129_dst.uast @@ -0,0 +1,702 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 900, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 965, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1041, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1247, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1214, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/129_src.uast b/uast/diff/testdata/129_src.uast new file mode 100644 index 00000000..2eeac0e7 --- /dev/null +++ b/uast/diff/testdata/129_src.uast @@ -0,0 +1,694 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 27, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 28, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1188, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1224, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1275, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/12_dst.uast b/uast/diff/testdata/12_dst.uast new file mode 100644 index 00000000..ba157e75 --- /dev/null +++ b/uast/diff/testdata/12_dst.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 2, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/12_src.uast b/uast/diff/testdata/12_src.uast new file mode 100644 index 00000000..99e9c673 --- /dev/null +++ b/uast/diff/testdata/12_src.uast @@ -0,0 +1,317 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "TryExcept", + '@role': [Catch, Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 4, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 4, + col: 13, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 103, + line: 4, + col: 42, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 4, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 126, + line: 4, + col: 65, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + kwargs: ~, + starargs: ~, + }, + }, + ], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 128, + line: 5, + col: 1, + }, + }, + '@token': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 146, + line: 5, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 20, + }, + }, + Name: "e", + }, + body: [ + { '@type': "Print", + '@token': "print", + '@role': [Call, Callee, Expression, Function, Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 153, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 158, + line: 6, + col: 10, + }, + }, + dest: ~, + nl: true, + values: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 6, + col: 22, + }, + }, + Format: "", + Value: "Error: %s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 6, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 6, + col: 26, + }, + }, + Name: "e", + }, + }, + ], + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 135, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 5, + col: 17, + }, + }, + Name: "Exception", + }, + }, + ], + orelse: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/130_dst.uast b/uast/diff/testdata/130_dst.uast new file mode 100644 index 00000000..6df82b85 --- /dev/null +++ b/uast/diff/testdata/130_dst.uast @@ -0,0 +1,710 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1231, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1315, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1329, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/130_src.uast b/uast/diff/testdata/130_src.uast new file mode 100644 index 00000000..58257bff --- /dev/null +++ b/uast/diff/testdata/130_src.uast @@ -0,0 +1,702 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 900, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 915, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 965, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1028, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1041, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1211, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1247, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1214, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/131_dst.uast b/uast/diff/testdata/131_dst.uast new file mode 100644 index 00000000..645ba4aa --- /dev/null +++ b/uast/diff/testdata/131_dst.uast @@ -0,0 +1,718 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 30, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 975, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1009, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 35, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 39, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1291, + line: 40, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 39, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 39, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1356, + line: 43, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/131_src.uast b/uast/diff/testdata/131_src.uast new file mode 100644 index 00000000..6df82b85 --- /dev/null +++ b/uast/diff/testdata/131_src.uast @@ -0,0 +1,710 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1231, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1315, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1329, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/132_dst.uast b/uast/diff/testdata/132_dst.uast new file mode 100644 index 00000000..a95fa1cf --- /dev/null +++ b/uast/diff/testdata/132_dst.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1175, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1192, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1203, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1206, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1226, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1232, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1235, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1261, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/132_src.uast b/uast/diff/testdata/132_src.uast new file mode 100644 index 00000000..3117b6d5 --- /dev/null +++ b/uast/diff/testdata/132_src.uast @@ -0,0 +1,1062 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 4, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 4, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 190, + line: 7, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 90, + line: 5, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 197, + line: 7, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 9, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 9, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 10, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 10, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 267, + line: 10, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 272, + line: 10, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 10, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 10, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 9, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 226, + line: 9, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 9, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 226, + line: 9, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 12, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 12, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 13, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 13, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 346, + line: 13, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 351, + line: 13, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 13, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 13, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 12, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 12, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 12, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 12, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 15, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 15, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 15, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 15, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 15, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 15, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 15, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 15, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 15, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 415, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 16, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 16, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 435, + line: 16, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 16, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 19, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 19, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 478, + line: 19, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 655, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 25, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 703, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 26, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 26, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 721, + line: 26, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 686, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 686, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 29, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 931, + line: 29, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 29, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 29, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 950, + line: 29, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 29, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 956, + line: 29, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 29, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 29, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 979, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 30, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 988, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 998, + line: 30, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 30, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1011, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 31, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 31, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/133_dst.uast b/uast/diff/testdata/133_dst.uast new file mode 100644 index 00000000..7775525f --- /dev/null +++ b/uast/diff/testdata/133_dst.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1176, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1193, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1198, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1214, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1227, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1236, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1249, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1263, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/133_src.uast b/uast/diff/testdata/133_src.uast new file mode 100644 index 00000000..a95fa1cf --- /dev/null +++ b/uast/diff/testdata/133_src.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1175, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1192, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1203, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1206, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1226, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1232, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1235, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1261, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/134_dst.uast b/uast/diff/testdata/134_dst.uast new file mode 100644 index 00000000..914db487 --- /dev/null +++ b/uast/diff/testdata/134_dst.uast @@ -0,0 +1,1504 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 28, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 28, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 28, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 28, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 28, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 28, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 28, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 28, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 30, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 32, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 32, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 32, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 978, + line: 32, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 32, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 963, + line: 32, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 32, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1030, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 36, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 36, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1075, + line: 36, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1049, + line: 36, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1048, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 37, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 37, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1122, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 37, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1243, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 40, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 40, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 40, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 40, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 41, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1276, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 41, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1323, + line: 42, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1343, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 43, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/134_src.uast b/uast/diff/testdata/134_src.uast new file mode 100644 index 00000000..13751a15 --- /dev/null +++ b/uast/diff/testdata/134_src.uast @@ -0,0 +1,1448 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Logger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 25, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 27, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 27, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 27, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 27, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 27, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 27, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 27, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 764, + line: 27, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 733, + line: 26, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 830, + line: 29, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 831, + line: 29, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 29, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 863, + line: 30, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 31, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 908, + line: 31, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 31, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 916, + line: 31, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 31, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 31, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 31, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 922, + line: 31, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 925, + line: 31, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 31, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 921, + line: 31, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 873, + line: 30, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 946, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 33, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 34, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 34, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 34, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1038, + line: 35, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 35, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 35, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1024, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1033, + line: 35, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1004, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1003, + line: 35, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 36, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1081, + line: 36, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 36, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 36, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1208, + line: 39, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1210, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 39, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1215, + line: 39, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 39, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 40, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 40, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 40, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 40, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1274, + line: 41, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1273, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/135_dst.uast b/uast/diff/testdata/135_dst.uast new file mode 100644 index 00000000..fba6d60a --- /dev/null +++ b/uast/diff/testdata/135_dst.uast @@ -0,0 +1,1494 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_PackageBoundObject", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_endpoint_from_view_func", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 314, + line: 15, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 357, + line: 18, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 436, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 468, + line: 23, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 23, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 475, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 31, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 31, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 872, + line: 33, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 980, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 35, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1009, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1015, + line: 36, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1036, + line: 36, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1023, + line: 36, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 36, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 38, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 38, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1166, + line: 38, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1162, + line: 38, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1139, + line: 38, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 991, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 35, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 987, + line: 35, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1195, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 39, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 39, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 39, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 39, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1177, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1186, + line: 39, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1185, + line: 39, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1220, + line: 39, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 39, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 40, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1279, + line: 40, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1300, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1302, + line: 42, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1371, + line: 43, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1375, + line: 43, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1374, + line: 43, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1392, + line: 43, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1400, + line: 43, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 42, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1335, + line: 42, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1334, + line: 42, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1346, + line: 42, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 42, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1319, + line: 42, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1324, + line: 42, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1310, + line: 42, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 33, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 33, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 918, + line: 33, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 34, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 34, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/135_src.uast b/uast/diff/testdata/135_src.uast new file mode 100644 index 00000000..a62016bb --- /dev/null +++ b/uast/diff/testdata/135_src.uast @@ -0,0 +1,8556 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 233, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_PackageBoundObject", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_endpoint_from_view_func", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 293, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 15, + col: 21, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_register_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 20, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 20, + col: 8, + }, + }, + Format: "", + Value: "Internal helper function that returns a function for recording\n that registers the `send_static_file` function for the module on\n the application if necessary. It also registers the module on\n the application.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 575, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 21, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_register", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 22, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 22, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 22, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 626, + line: 22, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 22, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 22, + col: 33, + }, + }, + Name: "module", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 22, + col: 27, + }, + }, + Name: "name", + }, + ], + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 22, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 607, + line: 22, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 22, + col: 14, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 22, + col: 18, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 22, + col: 9, + }, + }, + Name: "modules", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 634, + line: 22, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 22, + col: 48, + }, + }, + Name: "module", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 774, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 776, + line: 25, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 26, + col: 19, + }, + }, + value: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 777, + line: 25, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 801, + line: 25, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 807, + line: 25, + col: 42, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 25, + col: 41, + }, + }, + Name: "module", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 25, + col: 35, + }, + }, + Name: "root_path", + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 778, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 783, + line: 25, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 777, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 17, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 783, + line: 25, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 25, + col: 21, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 777, + line: 25, + col: 12, + }, + }, + Name: "root_path", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 27, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 27, + col: 13, + }, + }, + Name: "path", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 852, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 863, + line: 27, + col: 27, + }, + }, + Name: "static_path", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 28, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + Name: "path", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 909, + line: 29, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 29, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 29, + col: 25, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 29, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 29, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 29, + col: 20, + }, + }, + Name: "static_path", + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 28, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 887, + line: 28, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 879, + line: 28, + col: 16, + }, + }, + Name: "path", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 30, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 971, + line: 31, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 971, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 975, + line: 31, + col: 17, + }, + }, + Name: "path", + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 978, + line: 31, + col: 20, + }, + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 979, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 31, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 978, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 31, + col: 25, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 978, + line: 31, + col: 20, + }, + }, + Name: "url_prefix", + }, + ], + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 31, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1001, + line: 31, + col: 43, + }, + }, + Name: "path", + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 947, + line: 30, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 30, + col: 17, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 30, + col: 12, + }, + }, + Name: "url_prefix", + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 32, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 32, + col: 9, + }, + }, + args: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1033, + line: 32, + col: 32, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1033, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 32, + col: 36, + }, + }, + Name: "path", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1040, + line: 32, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 32, + col: 57, + }, + }, + Format: "", + Value: "/", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1011, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1016, + line: 32, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1015, + line: 32, + col: 14, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 32, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1019, + line: 32, + col: 18, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 32, + col: 9, + }, + }, + Name: "add_url_rule", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "endpoint", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1100, + line: 33, + col: 41, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1100, + line: 33, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1111, + line: 33, + col: 52, + }, + }, + Format: "", + Value: "%s.static", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1115, + line: 33, + col: 56, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 33, + col: 62, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1114, + line: 33, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1120, + line: 33, + col: 61, + }, + }, + Name: "module", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1114, + line: 33, + col: 55, + }, + }, + Name: "name", + }, + ], + }, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "view_func", + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Argument, Expression, Identifier, Qualified, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1169, + line: 34, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 1175, + line: 34, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1168, + line: 34, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 1174, + line: 34, + col: 48, + }, + }, + Name: "module", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1168, + line: 34, + col: 42, + }, + }, + Name: "send_static_file", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Argument, Expression, Identifier, Qualified, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1235, + line: 35, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 1240, + line: 35, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 35, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 35, + col: 47, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1234, + line: 35, + col: 42, + }, + }, + Name: "subdomain", + }, + ], + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 21, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 21, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 21, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 21, + col: 24, + }, + }, + Name: "state", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1261, + line: 36, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1271, + line: 36, + col: 21, + }, + }, + Name: "_register", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 15, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 15, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 28, + }, + }, + Name: "module", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 15, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 15, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 15, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 15, + col: 41, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "_ModuleSetupState", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 39, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 39, + col: 24, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1298, + line: 39, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1304, + line: 39, + col: 31, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1324, + line: 41, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1378, + line: 42, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1379, + line: 42, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1383, + line: 42, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1378, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1382, + line: 42, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1378, + line: 42, + col: 9, + }, + }, + Name: "app", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1383, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1386, + line: 42, + col: 17, + }, + }, + Name: "app", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1401, + line: 43, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1402, + line: 43, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1406, + line: 43, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1401, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1405, + line: 43, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1401, + line: 43, + col: 9, + }, + }, + Name: "url_prefix", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1406, + line: 43, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1416, + line: 43, + col: 24, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1438, + line: 44, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1439, + line: 44, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1443, + line: 44, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1438, + line: 44, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1442, + line: 44, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1438, + line: 44, + col: 9, + }, + }, + Name: "subdomain", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1443, + line: 44, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1452, + line: 44, + col: 23, + }, + }, + Name: "subdomain", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1325, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1329, + line: 41, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1325, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1329, + line: 41, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1334, + line: 41, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1334, + line: 41, + col: 27, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1346, + line: 41, + col: 39, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1347, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1351, + line: 41, + col: 44, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1307, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1307, + line: 40, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1346, + line: 41, + col: 39, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 41, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 41, + col: 55, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1363, + line: 41, + col: 56, + }, + end: { '@type': "uast:Position", + offset: 1367, + line: 41, + col: 60, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 41, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 41, + col: 55, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1473, + line: 47, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 1479, + line: 47, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1480, + line: 47, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1499, + line: 47, + col: 33, + }, + }, + Name: "_PackageBoundObject", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4110, + line: 115, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1506, + line: 48, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 4117, + line: 115, + col: 8, + }, + }, + Format: "", + Value: "Container object that enables pluggable applications. A module can\n be used to organize larger applications. They represent blueprints that,\n in combination with a :class:`Flask` object are used to create a large\n application.\n\n A module is like an application bound to an `import_name`. Multiple\n modules can share the same import names, but in that case a `name` has\n to be provided to keep them apart. If different import names are used,\n the rightmost part of the import name is used as name.\n\n Here's an example structure for a larger application::\n\n /myapplication\n /__init__.py\n /views\n /__init__.py\n /admin.py\n /frontend.py\n\n The `myapplication/__init__.py` can look like this::\n\n from flask import Flask\n from myapplication.views.admin import admin\n from myapplication.views.frontend import frontend\n\n app = Flask(__name__)\n app.register_module(admin, url_prefix='/admin')\n app.register_module(frontend)\n\n And here's an example view module (`myapplication/views/admin.py`)::\n\n from flask import Module\n\n admin = Module(__name__)\n\n @admin.route('/')\n def index():\n pass\n\n @admin.route('/login')\n def login():\n pass\n\n For a gentle introduction into modules, checkout the\n :ref:`working-with-modules` section.\n\n .. versionadded:: 0.5\n The `static_path` parameter was added and it's now possible for\n modules to refer to their own templates and static files. See\n :ref:`modules-and-resources` for more information.\n\n .. versionadded:: 0.6\n The `subdomain` parameter was added.\n\n :param import_name: the name of the Python package or module\n implementing this :class:`Module`.\n :param name: the internal short name for the module. Unless specified\n the rightmost part of the import name\n :param url_prefix: an optional string that is used to prefix all the\n URL rules of this module. This can also be specified\n when registering the module with the application.\n :param subdomain: used to set the subdomain setting for URL rules that\n do not have a subdomain setting set.\n :param static_path: can be used to specify a different path for the\n static files on the web. Defaults to ``/static``.\n This does not affect the folder the files are served\n *from*.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4127, + line: 117, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4135, + line: 117, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4243, + line: 119, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4245, + line: 119, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4272, + line: 120, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4278, + line: 120, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4299, + line: 120, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4279, + line: 120, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4286, + line: 120, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 4297, + line: 120, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4279, + line: 120, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 4282, + line: 120, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4394, + line: 122, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4394, + line: 122, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4398, + line: 122, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4401, + line: 122, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4428, + line: 122, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 4429, + line: 122, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4401, + line: 122, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4412, + line: 122, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 4413, + line: 122, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4425, + line: 122, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 4426, + line: 122, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4402, + line: 122, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 4413, + line: 122, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4401, + line: 122, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 4412, + line: 122, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4401, + line: 122, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4246, + line: 119, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4254, + line: 119, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 4258, + line: 119, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4246, + line: 119, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 4250, + line: 119, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4439, + line: 123, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4439, + line: 123, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4468, + line: 123, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 4472, + line: 123, + col: 42, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4474, + line: 123, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 4485, + line: 123, + col: 55, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4440, + line: 123, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4459, + line: 123, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4439, + line: 123, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4458, + line: 123, + col: 28, + }, + }, + Name: "_PackageBoundObject", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4439, + line: 123, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4495, + line: 124, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4496, + line: 124, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4500, + line: 124, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4495, + line: 124, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4499, + line: 124, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4495, + line: 124, + col: 9, + }, + }, + Name: "name", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4500, + line: 124, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 4504, + line: 124, + col: 18, + }, + }, + Name: "name", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4520, + line: 125, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4521, + line: 125, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4525, + line: 125, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4520, + line: 125, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4524, + line: 125, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4520, + line: 125, + col: 9, + }, + }, + Name: "url_prefix", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4525, + line: 125, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 4535, + line: 125, + col: 24, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4557, + line: 126, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4558, + line: 126, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4562, + line: 126, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4557, + line: 126, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4561, + line: 126, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4557, + line: 126, + col: 9, + }, + }, + Name: "subdomain", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4562, + line: 126, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 4571, + line: 126, + col: 23, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4592, + line: 127, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4593, + line: 127, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4597, + line: 127, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4592, + line: 127, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4596, + line: 127, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4592, + line: 127, + col: 9, + }, + }, + Name: "view_functions", + }, + ], + }, + ], + value: { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4614, + line: 127, + col: 31, + }, + }, + keys: [], + values: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4625, + line: 128, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4626, + line: 128, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 4630, + line: 128, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4625, + line: 128, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4629, + line: 128, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4625, + line: 128, + col: 9, + }, + }, + Name: "_register_events", + }, + ], + }, + ], + value: { '@type': "List", + '@role': [Expression, List, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4649, + line: 128, + col: 33, + }, + }, + ctx: "Load", + elts: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4650, + line: 128, + col: 34, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4667, + line: 128, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 4671, + line: 128, + col: 55, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4673, + line: 128, + col: 57, + }, + end: { '@type': "uast:Position", + offset: 4684, + line: 128, + col: 68, + }, + }, + Name: "static_path", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4650, + line: 128, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 4666, + line: 128, + col: 50, + }, + }, + Name: "_register_module", + }, + keywords: [], + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4136, + line: 117, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 4140, + line: 117, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4136, + line: 117, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 4140, + line: 117, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4142, + line: 117, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 4153, + line: 117, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4142, + line: 117, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 4153, + line: 117, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4155, + line: 117, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 4159, + line: 117, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4160, + line: 117, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 4164, + line: 117, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4118, + line: 116, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 4118, + line: 116, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4155, + line: 117, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 4159, + line: 117, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4166, + line: 117, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 4176, + line: 117, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4177, + line: 117, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 4181, + line: 117, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4166, + line: 117, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 4176, + line: 117, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4200, + line: 118, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 4211, + line: 118, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4212, + line: 118, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 4216, + line: 118, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4200, + line: 118, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 4211, + line: 118, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4218, + line: 118, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 4227, + line: 118, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4228, + line: 118, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 4232, + line: 118, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4218, + line: 118, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 4227, + line: 118, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4696, + line: 130, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4701, + line: 130, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "route", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4876, + line: 133, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4734, + line: 131, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4887, + line: 133, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.route` but for a module. The endpoint for the\n :func:`url_for` function is prefixed with the name of the module.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4900, + line: 134, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4909, + line: 134, + col: 22, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "decorator", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4926, + line: 135, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4926, + line: 135, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4944, + line: 135, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 4948, + line: 135, + col: 35, + }, + }, + Name: "rule", + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4951, + line: 135, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 4952, + line: 135, + col: 39, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4950, + line: 135, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 4951, + line: 135, + col: 38, + }, + }, + Name: "f", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4950, + line: 135, + col: 37, + }, + }, + Name: "__name__", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4962, + line: 135, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 4963, + line: 135, + col: 50, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4927, + line: 135, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 4931, + line: 135, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4926, + line: 135, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4930, + line: 135, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4926, + line: 135, + col: 13, + }, + }, + Name: "add_url_rule", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4967, + line: 135, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 4974, + line: 135, + col: 61, + }, + }, + Name: "options", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4988, + line: 136, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4994, + line: 136, + col: 19, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4995, + line: 136, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 4996, + line: 136, + col: 21, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4910, + line: 134, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 4911, + line: 134, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4910, + line: 134, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 4911, + line: 134, + col: 24, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5005, + line: 137, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 5011, + line: 137, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5012, + line: 137, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 5021, + line: 137, + col: 25, + }, + }, + Name: "decorator", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4702, + line: 130, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 4706, + line: 130, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4702, + line: 130, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 4706, + line: 130, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4708, + line: 130, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 4712, + line: 130, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4708, + line: 130, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 4712, + line: 130, + col: 25, + }, + }, + Name: "rule", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4716, + line: 130, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 4723, + line: 130, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4716, + line: 130, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 4723, + line: 130, + col: 36, + }, + }, + Name: "options", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5031, + line: 139, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 5043, + line: 139, + col: 21, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_url_rule", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5476, + line: 147, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5107, + line: 140, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 5487, + line: 147, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.add_url_rule` but for a module. The endpoint for\n the :func:`url_for` function is prefixed with the name of the module.\n\n .. versionchanged:: 0.6\n The `endpoint` argument is now optional and will default to the\n function name to consistent with the function of the same name\n on the application object.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5500, + line: 148, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5513, + line: 148, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "register_rule", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5534, + line: 149, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5534, + line: 149, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5542, + line: 149, + col: 21, + }, + }, + Name: "the_rule", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5545, + line: 149, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 5549, + line: 149, + col: 28, + }, + }, + Name: "rule", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5562, + line: 150, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5564, + line: 150, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5599, + line: 151, + col: 17, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5599, + line: 151, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 5607, + line: 151, + col: 25, + }, + }, + Name: "the_rule", + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5610, + line: 151, + col: 28, + }, + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5611, + line: 151, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 5616, + line: 151, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5610, + line: 151, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 5615, + line: 151, + col: 33, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5610, + line: 151, + col: 28, + }, + }, + Name: "url_prefix", + }, + ], + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5629, + line: 151, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 5633, + line: 151, + col: 51, + }, + }, + Name: "rule", + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5566, + line: 150, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 5571, + line: 150, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5565, + line: 150, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 5570, + line: 150, + col: 21, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5565, + line: 150, + col: 16, + }, + }, + Name: "url_prefix", + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5646, + line: 152, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5646, + line: 152, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5665, + line: 152, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 5676, + line: 152, + col: 43, + }, + }, + Format: "", + Value: "subdomain", + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5679, + line: 152, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 5684, + line: 152, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5678, + line: 152, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 5683, + line: 152, + col: 50, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5678, + line: 152, + col: 45, + }, + }, + Name: "subdomain", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5647, + line: 152, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 5654, + line: 152, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5646, + line: 152, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5653, + line: 152, + col: 20, + }, + }, + Name: "options", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5646, + line: 152, + col: 13, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5707, + line: 153, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5707, + line: 153, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5719, + line: 153, + col: 25, + }, + }, + Name: "the_endpoint", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5722, + line: 153, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 5730, + line: 153, + col: 36, + }, + }, + Name: "endpoint", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5743, + line: 154, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5745, + line: 154, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5784, + line: 155, + col: 17, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5784, + line: 155, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 5796, + line: 155, + col: 29, + }, + }, + Name: "the_endpoint", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5799, + line: 155, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5824, + line: 155, + col: 57, + }, + end: { '@type': "uast:Position", + offset: 5833, + line: 155, + col: 66, + }, + }, + Name: "view_func", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5799, + line: 155, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 5823, + line: 155, + col: 56, + }, + }, + Name: "_endpoint_from_view_func", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5746, + line: 154, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5762, + line: 154, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 5766, + line: 154, + col: 36, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5746, + line: 154, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 5758, + line: 154, + col: 28, + }, + }, + Name: "the_endpoint", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5847, + line: 156, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5847, + line: 156, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5870, + line: 156, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 5878, + line: 156, + col: 44, + }, + }, + Name: "the_rule", + }, + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5880, + line: 156, + col: 46, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5880, + line: 156, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 5887, + line: 156, + col: 53, + }, + }, + Format: "", + Value: "%s.%s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Tuple", + '@role': [Binary, Expression, Literal, Primitive, Right, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5891, + line: 156, + col: 57, + }, + }, + ctx: "Load", + elts: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5892, + line: 156, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 5896, + line: 156, + col: 62, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5891, + line: 156, + col: 57, + }, + end: { '@type': "uast:Position", + offset: 5895, + line: 156, + col: 61, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5891, + line: 156, + col: 57, + }, + }, + Name: "name", + }, + ], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5958, + line: 157, + col: 57, + }, + end: { '@type': "uast:Position", + offset: 5970, + line: 157, + col: 69, + }, + }, + Name: "the_endpoint", + }, + ], + }, + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6008, + line: 158, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 6017, + line: 158, + col: 45, + }, + }, + Name: "view_func", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5848, + line: 156, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 5853, + line: 156, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5847, + line: 156, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 5852, + line: 156, + col: 18, + }, + }, + Name: "state", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5853, + line: 156, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 5856, + line: 156, + col: 22, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5847, + line: 156, + col: 13, + }, + }, + Name: "add_url_rule", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6021, + line: 158, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 6028, + line: 158, + col: 56, + }, + }, + Name: "options", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5514, + line: 148, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 5519, + line: 148, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5514, + line: 148, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 5519, + line: 148, + col: 32, + }, + }, + Name: "state", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6038, + line: 159, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6038, + line: 159, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6051, + line: 159, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 6064, + line: 159, + col: 35, + }, + }, + Name: "register_rule", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6039, + line: 159, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 6043, + line: 159, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6038, + line: 159, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6042, + line: 159, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6038, + line: 159, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5044, + line: 139, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 5048, + line: 139, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5044, + line: 139, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 5048, + line: 139, + col: 26, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5050, + line: 139, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 5054, + line: 139, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5050, + line: 139, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 5054, + line: 139, + col: 32, + }, + }, + Name: "rule", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5056, + line: 139, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 5064, + line: 139, + col: 42, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5065, + line: 139, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 5069, + line: 139, + col: 47, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5022, + line: 138, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 5022, + line: 138, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5056, + line: 139, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 5064, + line: 139, + col: 42, + }, + }, + Name: "endpoint", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5071, + line: 139, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 5080, + line: 139, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5081, + line: 139, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 5085, + line: 139, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5071, + line: 139, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 5080, + line: 139, + col: 58, + }, + }, + Name: "view_func", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5089, + line: 139, + col: 67, + }, + end: { '@type': "uast:Position", + offset: 5096, + line: 139, + col: 74, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5089, + line: 139, + col: 67, + }, + end: { '@type': "uast:Position", + offset: 5096, + line: 139, + col: 74, + }, + }, + Name: "options", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6090, + line: 161, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 6098, + line: 161, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "endpoint", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6109, + line: 162, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6109, + line: 162, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6160, + line: 162, + col: 60, + }, + }, + Format: "", + Value: "Like :meth:`Flask.endpoint` but for a module.", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6173, + line: 163, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 6182, + line: 163, + col: 22, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "decorator", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6199, + line: 164, + col: 13, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6199, + line: 164, + col: 13, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6219, + line: 164, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 6227, + line: 164, + col: 41, + }, + }, + Name: "endpoint", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6200, + line: 164, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 6204, + line: 164, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6199, + line: 164, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 6203, + line: 164, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6199, + line: 164, + col: 13, + }, + }, + Name: "view_functions", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6231, + line: 164, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 6232, + line: 164, + col: 46, + }, + }, + Name: "f", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6245, + line: 165, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 6251, + line: 165, + col: 19, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6252, + line: 165, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 6253, + line: 165, + col: 21, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6183, + line: 163, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 6184, + line: 163, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6183, + line: 163, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 6184, + line: 163, + col: 24, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6262, + line: 166, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6268, + line: 166, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6269, + line: 166, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 6278, + line: 166, + col: 25, + }, + }, + Name: "decorator", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6084, + line: 161, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 6088, + line: 161, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6084, + line: 161, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 6088, + line: 161, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6075, + line: 161, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6083, + line: 161, + col: 17, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6075, + line: 161, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6083, + line: 161, + col: 17, + }, + }, + Name: "endpoint", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6288, + line: 168, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6302, + line: 168, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "before_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6490, + line: 172, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6321, + line: 169, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6501, + line: 172, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.before_request` but for a module. This function\n is only executed before each request that is handled by a function of\n that module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6510, + line: 173, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6510, + line: 173, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6523, + line: 173, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 6529, + line: 173, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6530, + line: 173, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6531, + line: 173, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6530, + line: 173, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6531, + line: 173, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6533, + line: 173, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6606, + line: 174, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 6607, + line: 174, + col: 48, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6534, + line: 173, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6533, + line: 173, + col: 32, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6585, + line: 174, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 6589, + line: 174, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6584, + line: 174, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 6588, + line: 174, + col: 29, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6584, + line: 174, + col: 25, + }, + }, + Name: "name", + }, + ], + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6595, + line: 174, + col: 36, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6534, + line: 173, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 6535, + line: 173, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6533, + line: 173, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 6534, + line: 173, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6535, + line: 173, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 6538, + line: 173, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6539, + line: 173, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 6559, + line: 173, + col: 58, + }, + }, + Name: "before_request_funcs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6533, + line: 173, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6533, + line: 173, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6511, + line: 173, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 6515, + line: 173, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6510, + line: 173, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6514, + line: 173, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6510, + line: 173, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6618, + line: 175, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6624, + line: 175, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6625, + line: 175, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 6626, + line: 175, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6303, + line: 168, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 6307, + line: 168, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6303, + line: 168, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 6307, + line: 168, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6309, + line: 168, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 6310, + line: 168, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6309, + line: 168, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 6310, + line: 168, + col: 31, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6636, + line: 177, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6654, + line: 177, + col: 27, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "before_app_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6798, + line: 180, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6673, + line: 178, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6809, + line: 180, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.before_request`. Such a function is executed\n before each request, even if outside of a module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6818, + line: 181, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6818, + line: 181, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6831, + line: 181, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 6837, + line: 181, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6838, + line: 181, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6839, + line: 181, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6838, + line: 181, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6839, + line: 181, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6841, + line: 181, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6909, + line: 182, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 6910, + line: 182, + col: 43, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6842, + line: 181, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6841, + line: 181, + col: 32, + }, + }, + args: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Argument, Call, Expression, Function, Literal, Name, 'Null', Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6892, + line: 182, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 6896, + line: 182, + col: 29, + }, + }, + LiteralValue: "None", + value: ~, + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6898, + line: 182, + col: 31, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6842, + line: 181, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 6843, + line: 181, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6841, + line: 181, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 6842, + line: 181, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6843, + line: 181, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 6846, + line: 181, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6847, + line: 181, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 6867, + line: 181, + col: 58, + }, + }, + Name: "before_request_funcs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6841, + line: 181, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6841, + line: 181, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6819, + line: 181, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 6823, + line: 181, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6818, + line: 181, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6822, + line: 181, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6818, + line: 181, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6921, + line: 183, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6927, + line: 183, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6928, + line: 183, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 6929, + line: 183, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6655, + line: 177, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 6659, + line: 177, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6655, + line: 177, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 6659, + line: 177, + col: 32, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6661, + line: 177, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 6662, + line: 177, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6661, + line: 177, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 6662, + line: 177, + col: 35, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6939, + line: 185, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 6952, + line: 185, + col: 22, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7138, + line: 189, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6971, + line: 186, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7149, + line: 189, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.after_request` but for a module. This function\n is only executed after each request that is handled by a function of\n that module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7158, + line: 190, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7158, + line: 190, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7171, + line: 190, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 7177, + line: 190, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7178, + line: 190, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7179, + line: 190, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7178, + line: 190, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7179, + line: 190, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7181, + line: 190, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7253, + line: 191, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 7254, + line: 191, + col: 48, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7182, + line: 190, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7181, + line: 190, + col: 32, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7232, + line: 191, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 7236, + line: 191, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7231, + line: 191, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 7235, + line: 191, + col: 29, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7231, + line: 191, + col: 25, + }, + }, + Name: "name", + }, + ], + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7242, + line: 191, + col: 36, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7182, + line: 190, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7183, + line: 190, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7181, + line: 190, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 7182, + line: 190, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7183, + line: 190, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 7186, + line: 190, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7187, + line: 190, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 7206, + line: 190, + col: 57, + }, + }, + Name: "after_request_funcs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7181, + line: 190, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7181, + line: 190, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7159, + line: 190, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 7163, + line: 190, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7158, + line: 190, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7162, + line: 190, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7158, + line: 190, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7265, + line: 192, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7271, + line: 192, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7272, + line: 192, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 7273, + line: 192, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6953, + line: 185, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 6957, + line: 185, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6953, + line: 185, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 6957, + line: 185, + col: 27, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6959, + line: 185, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6960, + line: 185, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 6959, + line: 185, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 6960, + line: 185, + col: 30, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7283, + line: 194, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7300, + line: 194, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_app_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7461, + line: 197, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7319, + line: 195, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7472, + line: 197, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.after_request` but for a module. Such a function\n is executed after each request, even if outside of the module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7481, + line: 198, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7481, + line: 198, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7494, + line: 198, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 7500, + line: 198, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7501, + line: 198, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7502, + line: 198, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7501, + line: 198, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7502, + line: 198, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7504, + line: 198, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7571, + line: 199, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 7572, + line: 199, + col: 43, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7505, + line: 198, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7504, + line: 198, + col: 32, + }, + }, + args: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Argument, Call, Expression, Function, Literal, Name, 'Null', Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7554, + line: 199, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 7558, + line: 199, + col: 29, + }, + }, + LiteralValue: "None", + value: ~, + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7560, + line: 199, + col: 31, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7505, + line: 198, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7506, + line: 198, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7504, + line: 198, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 7505, + line: 198, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7506, + line: 198, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 7509, + line: 198, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7510, + line: 198, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 7529, + line: 198, + col: 57, + }, + }, + Name: "after_request_funcs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7504, + line: 198, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7504, + line: 198, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7482, + line: 198, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 7486, + line: 198, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7481, + line: 198, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7485, + line: 198, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7481, + line: 198, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7583, + line: 200, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7589, + line: 200, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7590, + line: 200, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 7591, + line: 200, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7301, + line: 194, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 7305, + line: 194, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7301, + line: 194, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 7305, + line: 194, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7307, + line: 194, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7308, + line: 194, + col: 34, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7307, + line: 194, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7308, + line: 194, + col: 34, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7601, + line: 202, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7618, + line: 202, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "context_processor", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7769, + line: 205, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7637, + line: 203, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7780, + line: 205, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.context_processor` but for a module. This\n function is only executed for requests handled by a module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7789, + line: 206, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7789, + line: 206, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7802, + line: 206, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 7808, + line: 206, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7809, + line: 206, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7810, + line: 206, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7809, + line: 206, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 7810, + line: 206, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7812, + line: 206, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7892, + line: 207, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 7893, + line: 207, + col: 48, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7813, + line: 206, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7812, + line: 206, + col: 32, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7871, + line: 207, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 7875, + line: 207, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7870, + line: 207, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 7874, + line: 207, + col: 29, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7870, + line: 207, + col: 25, + }, + }, + Name: "name", + }, + ], + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7881, + line: 207, + col: 36, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7813, + line: 206, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7814, + line: 206, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7812, + line: 206, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 7813, + line: 206, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7814, + line: 206, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 7817, + line: 206, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7818, + line: 206, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 7845, + line: 206, + col: 65, + }, + }, + Name: "template_context_processors", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7812, + line: 206, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7812, + line: 206, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7790, + line: 206, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 7794, + line: 206, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7789, + line: 206, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7793, + line: 206, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7789, + line: 206, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7904, + line: 208, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7910, + line: 208, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7911, + line: 208, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 7912, + line: 208, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7619, + line: 202, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 7623, + line: 202, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7619, + line: 202, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 7623, + line: 202, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7625, + line: 202, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7626, + line: 202, + col: 34, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7625, + line: 202, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 7626, + line: 202, + col: 34, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7922, + line: 210, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 7943, + line: 210, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "app_context_processor", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8102, + line: 213, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7962, + line: 211, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8113, + line: 213, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.context_processor` but for a module. Such a\n function is executed each request, even if outside of the module.\n ", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8122, + line: 214, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8122, + line: 214, + col: 9, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8135, + line: 214, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 8141, + line: 214, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8142, + line: 214, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 8143, + line: 214, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8142, + line: 214, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 8143, + line: 214, + col: 30, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8145, + line: 214, + col: 32, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8220, + line: 215, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 8221, + line: 215, + col: 43, + }, + }, + Name: "f", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8146, + line: 214, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8145, + line: 214, + col: 32, + }, + }, + args: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Argument, Call, Expression, Function, Literal, Name, 'Null', Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8203, + line: 215, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 8207, + line: 215, + col: 29, + }, + }, + LiteralValue: "None", + value: ~, + }, + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8209, + line: 215, + col: 31, + }, + }, + ctx: "Load", + elts: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8146, + line: 214, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 8147, + line: 214, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8145, + line: 214, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 8146, + line: 214, + col: 33, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8147, + line: 214, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 8150, + line: 214, + col: 37, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8151, + line: 214, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 8178, + line: 214, + col: 65, + }, + }, + Name: "template_context_processors", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8145, + line: 214, + col: 32, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8145, + line: 214, + col: 32, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8123, + line: 214, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 8127, + line: 214, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8122, + line: 214, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8126, + line: 214, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8122, + line: 214, + col: 9, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8232, + line: 216, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8238, + line: 216, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8239, + line: 216, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 8240, + line: 216, + col: 17, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7944, + line: 210, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 7948, + line: 210, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7944, + line: 210, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 7948, + line: 210, + col: 35, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7950, + line: 210, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 7951, + line: 210, + col: 38, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7950, + line: 210, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 7951, + line: 210, + col: 38, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8250, + line: 218, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8266, + line: 218, + col: 25, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "app_errorhandler", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8451, + line: 223, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8288, + line: 219, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8462, + line: 223, + col: 12, + }, + }, + Format: "", + Value: "Like :meth:`Flask.errorhandler` but for a module. This\n handler is used for all requests, even if outside of the module.\n\n .. versionadded:: 0.4\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8475, + line: 224, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 8484, + line: 224, + col: 22, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "decorator", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8501, + line: 225, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8501, + line: 225, + col: 13, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8514, + line: 225, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 8520, + line: 225, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8521, + line: 225, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 8522, + line: 225, + col: 34, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8521, + line: 225, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 8522, + line: 225, + col: 34, + }, + }, + Name: "s", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8524, + line: 225, + col: 36, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8549, + line: 225, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 8550, + line: 225, + col: 62, + }, + }, + Name: "f", + }, + ], + func: { '@type': "Call", + '@role': [Call, Callee, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8524, + line: 225, + col: 36, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8543, + line: 225, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 8547, + line: 225, + col: 59, + }, + }, + Name: "code", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8525, + line: 225, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 8526, + line: 225, + col: 38, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8524, + line: 225, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 8525, + line: 225, + col: 37, + }, + }, + Name: "s", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8526, + line: 225, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 8529, + line: 225, + col: 41, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8524, + line: 225, + col: 36, + }, + }, + Name: "errorhandler", + }, + ], + }, + keywords: [], + }, + keywords: [], + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8502, + line: 225, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 8506, + line: 225, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8501, + line: 225, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 8505, + line: 225, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8501, + line: 225, + col: 13, + }, + }, + Name: "_record", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8565, + line: 226, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 8571, + line: 226, + col: 19, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8572, + line: 226, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 8573, + line: 226, + col: 21, + }, + }, + Name: "f", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8485, + line: 224, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 8486, + line: 224, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8485, + line: 224, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 8486, + line: 224, + col: 24, + }, + }, + Name: "f", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8582, + line: 227, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8588, + line: 227, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8589, + line: 227, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 8598, + line: 227, + col: 25, + }, + }, + Name: "decorator", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8267, + line: 218, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 8271, + line: 218, + col: 30, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8267, + line: 218, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 8271, + line: 218, + col: 30, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8273, + line: 218, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 8277, + line: 218, + col: 36, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8273, + line: 218, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 8277, + line: 218, + col: 36, + }, + }, + Name: "code", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8608, + line: 229, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8615, + line: 229, + col: 16, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_record", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8637, + line: 230, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8637, + line: 230, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8666, + line: 230, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 8670, + line: 230, + col: 42, + }, + }, + Name: "func", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8638, + line: 230, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 8642, + line: 230, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8637, + line: 230, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 8641, + line: 230, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8642, + line: 230, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 8658, + line: 230, + col: 30, + }, + }, + Name: "_register_events", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8637, + line: 230, + col: 9, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8616, + line: 229, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 8620, + line: 229, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8616, + line: 229, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 8620, + line: 229, + col: 21, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8622, + line: 229, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 8626, + line: 229, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8622, + line: 229, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 8626, + line: 229, + col: 27, + }, + }, + Name: "func", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/136_dst.uast b/uast/diff/testdata/136_dst.uast new file mode 100644 index 00000000..426aa4b3 --- /dev/null +++ b/uast/diff/testdata/136_dst.uast @@ -0,0 +1,1482 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 14, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 300, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 19, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 19, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 17, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 17, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 22, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 30, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 30, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 913, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 915, + line: 34, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 35, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 35, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 35, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 35, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 35, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1064, + line: 37, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 37, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 37, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 37, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 37, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 37, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1071, + line: 37, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 924, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 34, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 916, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 34, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1128, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1134, + line: 38, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1140, + line: 38, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1118, + line: 38, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 38, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1153, + line: 38, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 39, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 39, + col: 65, + }, + end: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 76, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 41, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1333, + line: 42, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 42, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1336, + line: 42, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 42, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1362, + line: 42, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1293, + line: 41, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1297, + line: 41, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1296, + line: 41, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 41, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1308, + line: 41, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1316, + line: 41, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1280, + line: 41, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1281, + line: 41, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 41, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 41, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1279, + line: 41, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1266, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 41, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1268, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 41, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1265, + line: 41, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 32, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 32, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 32, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 834, + line: 32, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 31, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 825, + line: 32, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 32, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 851, + line: 32, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 32, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 32, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 882, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 33, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 33, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 33, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 33, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 33, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/136_src.uast b/uast/diff/testdata/136_src.uast new file mode 100644 index 00000000..fba6d60a --- /dev/null +++ b/uast/diff/testdata/136_src.uast @@ -0,0 +1,1494 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.module\n ~~~~~~~~~~~~\n\n Implements a class that represents module blueprints.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 219, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_PackageBoundObject", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_endpoint_from_view_func", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 314, + line: 15, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 357, + line: 18, + col: 24, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "blueprint_is_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 63, + }, + }, + Format: "", + Value: "Used to figure out if something is actually a module", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 436, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 448, + line: 20, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 25, + }, + }, + Name: "bp", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 33, + }, + }, + Name: "Module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 22, + }, + }, + Name: "isinstance", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 18, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 18, + col: 27, + }, + }, + Name: "bp", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "Module", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 468, + line: 23, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 23, + col: 13, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 475, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 23, + }, + }, + Name: "Blueprint", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 847, + line: 31, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 31, + col: 8, + }, + }, + Format: "", + Value: "Deprecated module support. Until Flask 0.6 modules were a different\n name of the concept now available as blueprints in Flask. They are\n essentially doing the same but have some bad semantics for templates and\n static files that were fixed with blueprints.\n\n .. versionchanged:: 0.7\n Modules were deprecated in favor for blueprints.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 872, + line: 33, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 980, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 35, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1009, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1015, + line: 36, + col: 19, + }, + }, + msg: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1036, + line: 36, + col: 40, + }, + }, + Format: "", + Value: "name required if package name does not point to a submodule", + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1023, + line: 36, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 36, + col: 38, + }, + }, + Name: "import_name", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 38, + col: 17, + }, + }, + Name: "name", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 38, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1166, + line: 38, + col: 48, + }, + }, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1162, + line: 38, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1163, + line: 38, + col: 45, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1139, + line: 38, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1149, + line: 38, + col: 31, + }, + }, + Name: "import_name", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1138, + line: 38, + col: 20, + }, + }, + Name: "rsplit", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 991, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 35, + col: 24, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 987, + line: 35, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1195, + line: 39, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 39, + col: 32, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 39, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 39, + col: 38, + }, + }, + Name: "name", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 39, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 39, + col: 51, + }, + }, + Name: "import_name", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1177, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1186, + line: 39, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1185, + line: 39, + col: 18, + }, + }, + Name: "Blueprint", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 39, + col: 9, + }, + }, + Name: "__init__", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1220, + line: 39, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 39, + col: 63, + }, + }, + Name: "url_prefix", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 40, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1279, + line: 40, + col: 37, + }, + }, + Name: "subdomain", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1300, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1302, + line: 42, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1371, + line: 43, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1375, + line: 43, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1374, + line: 43, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 43, + col: 13, + }, + }, + Name: "_static_folder", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1392, + line: 43, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1400, + line: 43, + col: 43, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 42, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1335, + line: 42, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1334, + line: 42, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 39, + }, + }, + Name: "root_path", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1346, + line: 42, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1354, + line: 42, + col: 63, + }, + }, + Format: "", + Value: "static", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 42, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1319, + line: 42, + col: 28, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1320, + line: 42, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 1324, + line: 42, + col: 33, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1317, + line: 42, + col: 26, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1304, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 14, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1310, + line: 42, + col: 19, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1303, + line: 42, + col: 12, + }, + }, + Name: "isdir", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 33, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 33, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 33, + col: 35, + }, + }, + Name: "import_name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 33, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 33, + col: 46, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 855, + line: 32, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 33, + col: 41, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 33, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 918, + line: 33, + col: 63, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 913, + line: 33, + col: 58, + }, + }, + Name: "url_prefix", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 34, + col: 34, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 937, + line: 34, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 34, + col: 29, + }, + }, + Name: "static_path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 34, + col: 50, + }, + }, + LiteralValue: "None", + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 34, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 34, + col: 45, + }, + }, + Name: "subdomain", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/137_dst.uast b/uast/diff/testdata/137_dst.uast new file mode 100644 index 00000000..cee2fe48 --- /dev/null +++ b/uast/diff/testdata/137_dst.uast @@ -0,0 +1,255 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: true, + Names: ~, + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/137_src.uast b/uast/diff/testdata/137_src.uast new file mode 100644 index 00000000..7775525f --- /dev/null +++ b/uast/diff/testdata/137_src.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1176, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1193, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1198, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1214, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1227, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1236, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1249, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1263, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/138_dst.uast b/uast/diff/testdata/138_dst.uast new file mode 100644 index 00000000..9ab45717 --- /dev/null +++ b/uast/diff/testdata/138_dst.uast @@ -0,0 +1,1504 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 28, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 28, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 28, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 28, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 28, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 28, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 28, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 28, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 30, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 32, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 32, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 32, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 978, + line: 32, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 32, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 963, + line: 32, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 32, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1030, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 36, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 36, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1075, + line: 36, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1049, + line: 36, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1048, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 37, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 37, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1122, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 37, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1243, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 40, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 40, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 40, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 40, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 41, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1276, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 41, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1323, + line: 42, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1343, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 43, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/138_src.uast b/uast/diff/testdata/138_src.uast new file mode 100644 index 00000000..914db487 --- /dev/null +++ b/uast/diff/testdata/138_src.uast @@ -0,0 +1,1504 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 28, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 28, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 28, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 28, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 28, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 28, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 28, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 28, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 30, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 32, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 32, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 32, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 978, + line: 32, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 32, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 963, + line: 32, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 32, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1030, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 36, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 36, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1075, + line: 36, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1049, + line: 36, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1048, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 37, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 37, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1122, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 37, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1243, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 40, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 40, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 40, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 40, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 41, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1276, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 41, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1323, + line: 42, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1343, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 43, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/139_dst.uast b/uast/diff/testdata/139_dst.uast new file mode 100644 index 00000000..4222605b --- /dev/null +++ b/uast/diff/testdata/139_dst.uast @@ -0,0 +1,1638 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 28, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 29, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 839, + line: 29, + col: 23, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 29, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 845, + line: 29, + col: 29, + }, + }, + Name: "DEBUG", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "BoolOp", + '@role': [Boolean, Condition, If, Incomplete, Literal], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 28, + col: 16, + }, + }, + op: { '@type': "And", + '@token': "and", + '@role': [And, Boolean, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + values: [ + { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 28, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 800, + line: 28, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 28, + col: 28, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 790, + line: 28, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 28, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 790, + line: 28, + col: 17, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 28, + col: 16, + }, + }, + Name: "level", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 807, + line: 28, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 810, + line: 28, + col: 37, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 28, + col: 36, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + Name: "debug", + }, + ], + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 858, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 30, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 30, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 891, + line: 30, + col: 46, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 30, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 872, + line: 30, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 30, + col: 26, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 30, + col: 20, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 904, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 916, + line: 32, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 32, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 930, + line: 32, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 949, + line: 33, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 34, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 34, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 34, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 34, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 996, + line: 34, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1002, + line: 34, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 34, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 988, + line: 34, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 987, + line: 34, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 34, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1022, + line: 34, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 1026, + line: 34, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 34, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 34, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 34, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 34, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 951, + line: 33, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 33, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 951, + line: 33, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 959, + line: 33, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 959, + line: 33, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1039, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1054, + line: 36, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 37, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 37, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1069, + line: 37, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 37, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1089, + line: 38, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1089, + line: 38, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 38, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1124, + line: 38, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1120, + line: 38, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1123, + line: 38, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1120, + line: 38, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 38, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 38, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1090, + line: 38, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1097, + line: 38, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1089, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 38, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1089, + line: 38, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 39, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 39, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1156, + line: 39, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1167, + line: 39, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1170, + line: 39, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1166, + line: 39, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1169, + line: 39, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1166, + line: 39, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1156, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1165, + line: 39, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1291, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1294, + line: 42, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 42, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1296, + line: 42, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1302, + line: 42, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1301, + line: 42, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 42, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 43, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1319, + line: 43, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1325, + line: 43, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1324, + line: 43, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1318, + line: 43, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1337, + line: 43, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1348, + line: 43, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 44, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 44, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1371, + line: 44, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1378, + line: 44, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1354, + line: 44, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1360, + line: 44, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 44, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1359, + line: 44, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1353, + line: 44, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1384, + line: 45, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1390, + line: 45, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1391, + line: 45, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1397, + line: 45, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/139_src.uast b/uast/diff/testdata/139_src.uast new file mode 100644 index 00000000..9ab45717 --- /dev/null +++ b/uast/diff/testdata/139_src.uast @@ -0,0 +1,1504 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.logging\n ~~~~~~~~~~~~~\n\n Implements the logging support for Flask.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 210, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 250, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLogger", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Formatter", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "getLoggerClass", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "DEBUG", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 17, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_logger", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 670, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Creates a logger for the given application. This logger works\n similar to a regular Python logger but changes the effective logging\n level based on the application's debug flag. Furthermore this\n function also removes all attached handlers in case there was a\n logger with the log name before.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 24, + col: 11, + }, + }, + Name: "Logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 691, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 24, + col: 28, + }, + }, + Name: "getLoggerClass", + }, + keywords: [], + }, + }, + { '@type': "ClassDef", + '@token': "DebugLogger", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 719, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 26, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 26, + col: 29, + }, + }, + Name: "Logger", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 27, + col: 30, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "getEffectiveLevel", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 28, + col: 19, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + }, + body: { '@type': "uast:Identifier", + '@role': [Body, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 28, + col: 25, + }, + }, + Name: "DEBUG", + }, + orelse: { '@type': "Call", + '@role': [Body, Call, Else, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 28, + col: 69, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 28, + col: 70, + }, + }, + Name: "x", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 818, + line: 28, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 51, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 823, + line: 28, + col: 50, + }, + }, + Name: "Logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 817, + line: 28, + col: 44, + }, + }, + Name: "getEffectiveLevel", + }, + ], + }, + keywords: [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 28, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 806, + line: 28, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 28, + col: 32, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 29, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 32, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "DebugHandler", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 30, + col: 23, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 882, + line: 30, + col: 37, + }, + }, + Name: "StreamHandler", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 897, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 31, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "emit", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + value: { '@type': "IfExp", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + body: { '@type': "Call", + '@role': [Body, Call, Expression, Function, If, Then], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 946, + line: 32, + col: 33, + }, + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 948, + line: 32, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 41, + }, + }, + Name: "record", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 32, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 32, + col: 26, + }, + }, + Name: "StreamHandler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 32, + col: 13, + }, + }, + Name: "emit", + }, + ], + }, + keywords: [], + }, + orelse: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Body, Else, Expression, If, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 974, + line: 32, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 978, + line: 32, + col: 65, + }, + }, + LiteralValue: "None", + value: ~, + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 32, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 963, + line: 32, + col: 50, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 32, + col: 49, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 32, + col: 46, + }, + }, + Name: "debug", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 902, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 19, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 31, + col: 27, + }, + }, + Name: "record", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 984, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 12, + }, + }, + Name: "handler", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 27, + }, + }, + Name: "DebugHandler", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1030, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1035, + line: 35, + col: 27, + }, + }, + Name: "DEBUG", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1014, + line: 35, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 35, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 35, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1013, + line: 35, + col: 5, + }, + }, + Name: "setLevel", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 36, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 36, + col: 40, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1075, + line: 36, + col: 39, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 36, + col: 36, + }, + }, + Name: "debug_log_format", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 36, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1071, + line: 36, + col: 35, + }, + }, + Name: "Formatter", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1042, + line: 36, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1049, + line: 36, + col: 13, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1048, + line: 36, + col: 12, + }, + }, + Name: "handler", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 36, + col: 5, + }, + }, + Name: "setFormatter", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 37, + col: 11, + }, + }, + Name: "logger", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 37, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1122, + line: 37, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 37, + col: 24, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 37, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 37, + col: 23, + }, + }, + Name: "getLogger", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1243, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 40, + col: 8, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + ctx: "Del", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 40, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 40, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 40, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 40, + col: 9, + }, + }, + Name: "handlers", + }, + ], + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1271, + line: 41, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 41, + col: 12, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1276, + line: 41, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1270, + line: 41, + col: 5, + }, + }, + Name: "__class__", + }, + ], + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1289, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 41, + col: 35, + }, + }, + Name: "DebugLogger", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1323, + line: 42, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1330, + line: 42, + col: 30, + }, + }, + Name: "handler", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 42, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1312, + line: 42, + col: 12, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1311, + line: 42, + col: 11, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 42, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1336, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1343, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 43, + col: 18, + }, + }, + Name: "logger", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 17, + col: 22, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/13_dst.uast b/uast/diff/testdata/13_dst.uast new file mode 100644 index 00000000..dcea5f8e --- /dev/null +++ b/uast/diff/testdata/13_dst.uast @@ -0,0 +1,323 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/13_src.uast b/uast/diff/testdata/13_src.uast new file mode 100644 index 00000000..58ffeb04 --- /dev/null +++ b/uast/diff/testdata/13_src.uast @@ -0,0 +1,498 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 234, + line: 10, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 267, + line: 11, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 266, + line: 11, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "debug", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 11, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 23, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 10, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 10, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 10, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 10, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/140_dst.uast b/uast/diff/testdata/140_dst.uast new file mode 100644 index 00000000..645ba4aa --- /dev/null +++ b/uast/diff/testdata/140_dst.uast @@ -0,0 +1,718 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 30, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 975, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1009, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 35, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 39, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1291, + line: 40, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 39, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 39, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1356, + line: 43, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/140_src.uast b/uast/diff/testdata/140_src.uast new file mode 100644 index 00000000..6df82b85 --- /dev/null +++ b/uast/diff/testdata/140_src.uast @@ -0,0 +1,710 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 982, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 34, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1228, + line: 38, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1230, + line: 38, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1264, + line: 39, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1231, + line: 38, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 38, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1315, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1329, + line: 42, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/141_dst.uast b/uast/diff/testdata/141_dst.uast new file mode 100644 index 00000000..c96e0853 --- /dev/null +++ b/uast/diff/testdata/141_dst.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 794, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 878, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 887, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 986, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1002, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1020, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1036, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1112, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1284, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1318, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1369, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1383, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/141_src.uast b/uast/diff/testdata/141_src.uast new file mode 100644 index 00000000..645ba4aa --- /dev/null +++ b/uast/diff/testdata/141_src.uast @@ -0,0 +1,718 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 30, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 975, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1009, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 35, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 39, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1291, + line: 40, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 39, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 39, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1356, + line: 43, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/142_dst.uast b/uast/diff/testdata/142_dst.uast new file mode 100644 index 00000000..bb327f7d --- /dev/null +++ b/uast/diff/testdata/142_dst.uast @@ -0,0 +1,1681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 17, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_req_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 19, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 429, + line: 20, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 479, + line: 20, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 20, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 19, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 21, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 21, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 21, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 21, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_app_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 25, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 578, + line: 26, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 27, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 26, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 671, + line: 28, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 683, + line: 28, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 685, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 28, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 28, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 706, + line: 31, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 32, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 721, + line: 32, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 735, + line: 32, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 32, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 743, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 34, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 34, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 34, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 33, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 35, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 35, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 884, + line: 39, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 39, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 40, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 927, + line: 40, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 41, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 41, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 41, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 42, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 995, + line: 42, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1013, + line: 42, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 42, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 42, + col: 59, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 42, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 986, + line: 42, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 43, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1056, + line: 43, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1074, + line: 43, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 43, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 43, + col: 59, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1055, + line: 43, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 1047, + line: 43, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1089, + line: 44, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1111, + line: 44, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1129, + line: 44, + col: 42, + }, + }, + Name: "_lookup_app_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 44, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1134, + line: 44, + col: 47, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1110, + line: 44, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1102, + line: 44, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/142_src.uast b/uast/diff/testdata/142_src.uast new file mode 100644 index 00000000..00bde417 --- /dev/null +++ b/uast/diff/testdata/142_src.uast @@ -0,0 +1,1681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 17, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_req_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 19, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 429, + line: 20, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 479, + line: 20, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 20, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 19, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 21, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 21, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 21, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 21, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_app_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 25, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 578, + line: 26, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 27, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 26, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 671, + line: 28, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 683, + line: 28, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 685, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 28, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 28, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 706, + line: 31, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 32, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 721, + line: 32, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 735, + line: 32, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 32, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 743, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 34, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 34, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 34, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 33, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 35, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 35, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 884, + line: 39, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 39, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 40, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 927, + line: 40, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 41, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 41, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 41, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 42, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 995, + line: 42, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1013, + line: 42, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 42, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 42, + col: 59, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 42, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 986, + line: 42, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 43, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1056, + line: 43, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1074, + line: 43, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 43, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 43, + col: 59, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1055, + line: 43, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 1047, + line: 43, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1089, + line: 44, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1111, + line: 44, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1129, + line: 44, + col: 42, + }, + }, + Name: "_lookup_app_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 44, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1134, + line: 44, + col: 47, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1110, + line: 44, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1102, + line: 44, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/143_dst.uast b/uast/diff/testdata/143_dst.uast new file mode 100644 index 00000000..b8137c85 --- /dev/null +++ b/uast/diff/testdata/143_dst.uast @@ -0,0 +1,1673 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 13, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 16, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 376, + line: 16, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 21, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 21, + col: 8, + }, + }, + Format: "", + Value: "Works like a regular Werkzeug test client but has some\n knowledge about how Flask works to defer the cleanup of the\n request context stack to the end of a with body when used\n in a with statement.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 23, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 23, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 23, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 23, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 649, + line: 23, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 659, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 696, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 698, + line: 26, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 27, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 753, + line: 27, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 28, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 28, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 776, + line: 28, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 28, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 704, + line: 26, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 26, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 30, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 29, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 848, + line: 29, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 850, + line: 29, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 29, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 817, + line: 29, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 30, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 30, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 31, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 31, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 31, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 31, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 982, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 988, + line: 33, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 33, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 33, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 33, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 33, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 33, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 33, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 33, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1022, + line: 33, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 35, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1057, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 35, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 1111, + line: 35, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 35, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1097, + line: 35, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 35, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1130, + line: 37, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1170, + line: 38, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1174, + line: 38, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 39, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1190, + line: 39, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1194, + line: 39, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 41, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 42, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 42, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1277, + line: 42, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 42, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1291, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1293, + line: 43, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 44, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 44, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1348, + line: 44, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 43, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1298, + line: 43, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/143_src.uast b/uast/diff/testdata/143_src.uast new file mode 100644 index 00000000..faadd6b4 --- /dev/null +++ b/uast/diff/testdata/143_src.uast @@ -0,0 +1,1647 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 13, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 16, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 376, + line: 16, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 400, + line: 18, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 420, + line: 18, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 423, + line: 18, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 20, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 475, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 21, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 22, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 532, + line: 22, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 23, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 23, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 581, + line: 23, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 21, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 21, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 21, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 25, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 627, + line: 24, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 24, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 597, + line: 24, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 596, + line: 24, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 25, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 681, + line: 25, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 677, + line: 25, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 26, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 710, + line: 26, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 26, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 26, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 26, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 26, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 747, + line: 27, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 28, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 784, + line: 28, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 28, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 28, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 791, + line: 28, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 28, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 774, + line: 28, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 28, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 795, + line: 28, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 28, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 833, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 837, + line: 30, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 30, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 30, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 30, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 30, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 858, + line: 30, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 876, + line: 30, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 30, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 857, + line: 30, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 20, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 20, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 20, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 20, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 20, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 32, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 33, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 930, + line: 33, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 33, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 33, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 33, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 33, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 962, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 34, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 34, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 34, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 32, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 32, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 32, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 32, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 36, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 991, + line: 36, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1033, + line: 37, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 37, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1036, + line: 37, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 37, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1056, + line: 37, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1061, + line: 37, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1072, + line: 38, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1110, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1128, + line: 39, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1127, + line: 39, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 39, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1074, + line: 38, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1078, + line: 38, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1077, + line: 38, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1073, + line: 38, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 36, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 36, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 992, + line: 36, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 36, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 998, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 36, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 998, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 36, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 36, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1017, + line: 36, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 36, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1017, + line: 36, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 36, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1019, + line: 36, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1021, + line: 36, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/144_dst.uast b/uast/diff/testdata/144_dst.uast new file mode 100644 index 00000000..48a4bf18 --- /dev/null +++ b/uast/diff/testdata/144_dst.uast @@ -0,0 +1,1673 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 299, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 14, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 17, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 371, + line: 17, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 377, + line: 17, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 22, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 22, + col: 8, + }, + }, + Format: "", + Value: "Works like a regular Werkzeug test client but has some\n knowledge about how Flask works to defer the cleanup of the\n request context stack to the end of a with body when used\n in a with statement.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 24, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 642, + line: 24, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 645, + line: 24, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 650, + line: 24, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 664, + line: 26, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 27, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 28, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 28, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 28, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 755, + line: 28, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 28, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 28, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 29, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 774, + line: 29, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 778, + line: 29, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 29, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 29, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 29, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 798, + line: 29, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 803, + line: 29, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 27, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 700, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 704, + line: 27, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 700, + line: 27, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 30, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 30, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 870, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 895, + line: 31, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 30, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 30, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 30, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 30, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 813, + line: 30, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 30, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 818, + line: 30, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 30, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 31, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 904, + line: 31, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 31, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 31, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 31, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 32, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 32, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 32, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 32, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 32, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 32, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 32, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 33, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 989, + line: 34, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 34, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1002, + line: 34, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 34, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 34, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1009, + line: 34, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1013, + line: 34, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 991, + line: 34, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 34, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 34, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 34, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1017, + line: 34, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1023, + line: 34, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 36, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1055, + line: 36, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1059, + line: 36, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 36, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 36, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 36, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 1112, + line: 36, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 36, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1098, + line: 36, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1097, + line: 36, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 36, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 26, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 26, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 26, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 686, + line: 26, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 26, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 686, + line: 26, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1122, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1131, + line: 38, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 39, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1148, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1152, + line: 39, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 39, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 39, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1171, + line: 39, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1175, + line: 39, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1184, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 40, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1191, + line: 40, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1195, + line: 40, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1136, + line: 38, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1132, + line: 38, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1136, + line: 38, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1205, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 42, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 43, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 43, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1259, + line: 43, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 43, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 43, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 43, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1283, + line: 43, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1292, + line: 44, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1294, + line: 44, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 45, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 45, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1332, + line: 45, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1350, + line: 45, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 45, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 45, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 45, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1296, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 44, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 44, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 44, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 44, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1214, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 42, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1214, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 42, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1220, + line: 42, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1228, + line: 42, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1220, + line: 42, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1228, + line: 42, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1230, + line: 42, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 42, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1230, + line: 42, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1239, + line: 42, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1241, + line: 42, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1243, + line: 42, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1241, + line: 42, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1243, + line: 42, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/144_src.uast b/uast/diff/testdata/144_src.uast new file mode 100644 index 00000000..b8137c85 --- /dev/null +++ b/uast/diff/testdata/144_src.uast @@ -0,0 +1,1673 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testing\n ~~~~~~~~~~~~~\n\n Implements test support helpers. This module is lazily imported\n and usually not used in production environments.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Client", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 13, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "FlaskClient", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 16, + col: 18, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 376, + line: 16, + col: 25, + }, + }, + Name: "Client", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 21, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 21, + col: 8, + }, + }, + Format: "", + Value: "Works like a regular Werkzeug test client but has some\n knowledge about how Flask works to defer the cleanup of the\n request context stack to the end of a with body when used\n in a with statement.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 23, + col: 21, + }, + }, + Name: "preserve_context", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 23, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 23, + col: 41, + }, + }, + Name: "context_preserved", + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 23, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 649, + line: 23, + col: 49, + }, + }, + value: false, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 659, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "open", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 696, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 698, + line: 26, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 27, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 754, + line: 27, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 753, + line: 27, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 735, + line: 27, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 28, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 28, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 776, + line: 28, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 797, + line: 28, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 802, + line: 28, + col: 43, + }, + }, + value: false, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 704, + line: 26, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 703, + line: 26, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 26, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 894, + line: 30, + col: 39, + }, + }, + Format: "", + Value: "flask._preserve_context", + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 29, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 848, + line: 29, + col: 46, + }, + }, + Format: "", + Value: "environ_overrides", + }, + { '@type': "Dict", + '@role': [Argument, Call, Expression, Function, Literal, Map, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 850, + line: 29, + col: 48, + }, + }, + keys: [], + values: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 812, + line: 29, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 818, + line: 29, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 817, + line: 29, + col: 15, + }, + }, + Name: "kwargs", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 29, + col: 9, + }, + }, + Name: "setdefault", + }, + ], + }, + keywords: [], + }, + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 30, + col: 48, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 30, + col: 47, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 898, + line: 30, + col: 43, + }, + }, + Name: "preserve_context", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 31, + col: 12, + }, + }, + Name: "old", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 935, + line: 31, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 953, + line: 31, + col: 34, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 952, + line: 31, + col: 33, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 31, + col: 15, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 982, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 988, + line: 33, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1005, + line: 33, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "Starred", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 33, + col: 38, + }, + }, + ctx: "Load", + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1008, + line: 33, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1012, + line: 33, + col: 43, + }, + }, + Name: "args", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 33, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 33, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 995, + line: 33, + col: 26, + }, + }, + Name: "Client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 989, + line: 33, + col: 20, + }, + }, + Name: "open", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: ~, + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 33, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1022, + line: 33, + col: 53, + }, + }, + Name: "kwargs", + }, + }, + ], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 35, + col: 18, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1057, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 35, + col: 13, + }, + }, + Name: "context_preserved", + }, + ], + }, + ], + value: { '@type': "Compare", + '@role': [Binary, Condition, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 35, + col: 68, + }, + end: { '@type': "uast:Position", + offset: 1111, + line: 35, + col: 71, + }, + }, + Name: "old", + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1079, + line: 35, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1097, + line: 35, + col: 57, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 35, + col: 56, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 35, + col: 38, + }, + }, + Name: "top", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 25, + col: 18, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 25, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 685, + line: 25, + col: 35, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 25, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1130, + line: 37, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__enter__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1147, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1151, + line: 38, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1150, + line: 38, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1146, + line: 38, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1170, + line: 38, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1174, + line: 38, + col: 37, + }, + }, + value: true, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 39, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1190, + line: 39, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1194, + line: 39, + col: 20, + }, + }, + Name: "self", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1135, + line: 37, + col: 23, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 41, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__exit__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 42, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 42, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 9, + }, + }, + Name: "preserve_context", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1277, + line: 42, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1282, + line: 42, + col: 38, + }, + }, + value: false, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1291, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1293, + line: 43, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1331, + line: 44, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1349, + line: 44, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1348, + line: 44, + col: 31, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1330, + line: 44, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "QualifiedIdentifier", + '@role': [Condition, Expression, Identifier, If, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 43, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1298, + line: 43, + col: 16, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1294, + line: 43, + col: 12, + }, + }, + Name: "context_preserved", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 41, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1219, + line: 41, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1227, + line: 41, + col: 32, + }, + }, + Name: "exc_type", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1229, + line: 41, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1238, + line: 41, + col: 43, + }, + }, + Name: "exc_value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1240, + line: 41, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 1242, + line: 41, + col: 47, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/145_dst.uast b/uast/diff/testdata/145_dst.uast new file mode 100644 index 00000000..c96e0853 --- /dev/null +++ b/uast/diff/testdata/145_dst.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 794, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 878, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 887, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 986, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1002, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1020, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1036, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1112, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1284, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1318, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1369, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1383, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/145_src.uast b/uast/diff/testdata/145_src.uast new file mode 100644 index 00000000..645ba4aa --- /dev/null +++ b/uast/diff/testdata/145_src.uast @@ -0,0 +1,718 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 754, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 28, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 944, + line: 30, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 975, + line: 31, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1009, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 35, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1255, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1257, + line: 39, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1291, + line: 40, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 39, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1272, + line: 39, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1342, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1356, + line: 43, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/146_dst.uast b/uast/diff/testdata/146_dst.uast new file mode 100644 index 00000000..1af4b7e3 --- /dev/null +++ b/uast/diff/testdata/146_dst.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.9", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 586, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 777, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 790, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 874, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 883, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 982, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 998, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1032, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1108, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1280, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1301, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1314, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1281, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1295, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1365, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1379, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/146_src.uast b/uast/diff/testdata/146_src.uast new file mode 100644 index 00000000..c96e0853 --- /dev/null +++ b/uast/diff/testdata/146_src.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.9-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 550, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 562, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 794, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 878, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 887, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 986, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1002, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1020, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1036, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1112, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1282, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1284, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1305, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1318, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1285, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1299, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1369, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1383, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/147_dst.uast b/uast/diff/testdata/147_dst.uast new file mode 100644 index 00000000..fe2a1e35 --- /dev/null +++ b/uast/diff/testdata/147_dst.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 281, + line: 13, + col: 25, + }, + }, + Format: "", + Value: "0.10-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 485, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 795, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 960, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 972, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1003, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1037, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1100, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1113, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1283, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1285, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1306, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1319, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1286, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1300, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1370, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1384, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/147_src.uast b/uast/diff/testdata/147_src.uast new file mode 100644 index 00000000..1af4b7e3 --- /dev/null +++ b/uast/diff/testdata/147_src.uast @@ -0,0 +1,726 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.9", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.exceptions", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.utils", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 19, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 22, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 586, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "stream_with_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 777, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 790, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_app_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 874, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 883, + line: 29, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_app_context", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "after_this_request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 967, + line: 31, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 982, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 998, + line: 32, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1032, + line: 33, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1095, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1108, + line: 36, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1278, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1280, + line: 40, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1301, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1314, + line: 41, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1281, + line: 40, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1295, + line: 40, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1365, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1379, + line: 44, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/14_dst.uast b/uast/diff/testdata/14_dst.uast new file mode 100644 index 00000000..252a6453 --- /dev/null +++ b/uast/diff/testdata/14_dst.uast @@ -0,0 +1,472 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 9, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 258, + line: 10, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 261, + line: 10, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + end: { '@type': "uast:Position", + offset: 260, + line: 10, + col: 6, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 9, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 243, + line: 9, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 9, + col: 24, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 9, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 241, + line: 9, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/14_src.uast b/uast/diff/testdata/14_src.uast new file mode 100644 index 00000000..dcea5f8e --- /dev/null +++ b/uast/diff/testdata/14_src.uast @@ -0,0 +1,323 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/15_dst.uast b/uast/diff/testdata/15_dst.uast new file mode 100644 index 00000000..5f515f47 --- /dev/null +++ b/uast/diff/testdata/15_dst.uast @@ -0,0 +1,682 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 264, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 331, + line: 16, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 17, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 17, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 17, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 17, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 371, + line: 17, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 18, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 18, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 18, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 19, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 19, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 520, + line: 19, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 19, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 20, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 20, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 551, + line: 20, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 20, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 20, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 20, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/15_src.uast b/uast/diff/testdata/15_src.uast new file mode 100644 index 00000000..f00b378d --- /dev/null +++ b/uast/diff/testdata/15_src.uast @@ -0,0 +1,656 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 62, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 62, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 107, + line: 5, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 5, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 121, + line: 5, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 127, + line: 5, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 130, + line: 5, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 5, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 148, + line: 5, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 151, + line: 5, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 5, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 6, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 6, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 6, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 184, + line: 6, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 187, + line: 6, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 205, + line: 6, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 204, + line: 6, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 6, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 6, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 6, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 6, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 7, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 7, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 7, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 7, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 7, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 266, + line: 7, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 7, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 7, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 266, + line: 7, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 7, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 7, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 7, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 7, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 279, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 279, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 8, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 8, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 8, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 300, + line: 8, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 303, + line: 8, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 321, + line: 8, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 8, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 320, + line: 8, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 321, + line: 8, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 8, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 8, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 8, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/16_dst.uast b/uast/diff/testdata/16_dst.uast new file mode 100644 index 00000000..0c42c446 --- /dev/null +++ b/uast/diff/testdata/16_dst.uast @@ -0,0 +1,321 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 28, + line: 3, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 3, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "admin", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.admin", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 89, + line: 5, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "frontend", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.frontend", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 137, + line: 6, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 137, + line: 6, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 160, + line: 6, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 6, + col: 29, + }, + }, + Name: "admin", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 6, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 141, + line: 6, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 137, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 140, + line: 6, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 137, + line: 6, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 190, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 198, + line: 7, + col: 32, + }, + }, + Name: "frontend", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 168, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 171, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/16_src.uast b/uast/diff/testdata/16_src.uast new file mode 100644 index 00000000..852e9402 --- /dev/null +++ b/uast/diff/testdata/16_src.uast @@ -0,0 +1,321 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 28, + line: 3, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 3, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "admin", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "moduleapp.apps.admin", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 86, + line: 5, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "frontend", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "moduleapp.apps.frontend", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 154, + line: 6, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 29, + }, + }, + Name: "admin", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 132, + line: 6, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 135, + line: 6, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 134, + line: 6, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 192, + line: 7, + col: 32, + }, + }, + Name: "frontend", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 162, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/17_dst.uast b/uast/diff/testdata/17_dst.uast new file mode 100644 index 00000000..762f83c7 --- /dev/null +++ b/uast/diff/testdata/17_dst.uast @@ -0,0 +1,425 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 28, + line: 3, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 3, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 65, + line: 4, + col: 19, + }, + }, + Format: "", + Value: "DEBUG", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 69, + line: 4, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "admin", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.admin", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 6, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "frontend", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.frontend", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 187, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 192, + line: 7, + col: 29, + }, + }, + Name: "admin", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 8, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 8, + col: 32, + }, + }, + Name: "frontend", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 198, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 197, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/17_src.uast b/uast/diff/testdata/17_src.uast new file mode 100644 index 00000000..762f83c7 --- /dev/null +++ b/uast/diff/testdata/17_src.uast @@ -0,0 +1,425 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 25, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 28, + line: 3, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 3, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 3, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 65, + line: 4, + col: 19, + }, + }, + Format: "", + Value: "DEBUG", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + Name: "config", + }, + ], + }, + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 69, + line: 4, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "admin", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.admin", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 6, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "frontend", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "blueprintapp.apps.frontend", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 187, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 192, + line: 7, + col: 29, + }, + }, + Name: "admin", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 8, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 8, + col: 32, + }, + }, + Name: "frontend", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 198, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 197, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 194, + line: 8, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/18_dst.uast b/uast/diff/testdata/18_dst.uast new file mode 100644 index 00000000..4cd61e1b --- /dev/null +++ b/uast/diff/testdata/18_dst.uast @@ -0,0 +1,251 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + Name: "frontend", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 3, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 77, + line: 3, + col: 32, + }, + }, + Format: "", + Value: "frontend", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 3, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 3, + col: 42, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 21, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 105, + line: 3, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 116, + line: 3, + col: 71, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 120, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 158, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 181, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 8, + col: 49, + }, + }, + Format: "", + Value: "frontend/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 180, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/18_src.uast b/uast/diff/testdata/18_src.uast new file mode 100644 index 00000000..cf1dd8fa --- /dev/null +++ b/uast/diff/testdata/18_src.uast @@ -0,0 +1,208 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + Name: "frontend", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 3, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 3, + col: 30, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 21, + }, + }, + Name: "Blueprint", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 124, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 140, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 161, + line: 8, + col: 49, + }, + }, + Format: "", + Value: "frontend/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 124, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/19_dst.uast b/uast/diff/testdata/19_dst.uast new file mode 100644 index 00000000..f2f9dffc --- /dev/null +++ b/uast/diff/testdata/19_dst.uast @@ -0,0 +1,325 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 49, + line: 4, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 4, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 24, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 15, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 88, + line: 4, + col: 45, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 92, + line: 7, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 127, + line: 9, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 133, + line: 9, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 150, + line: 9, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 9, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 9, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 12, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 220, + line: 14, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 14, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 14, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/19_src.uast b/uast/diff/testdata/19_src.uast new file mode 100644 index 00000000..9e4790ed --- /dev/null +++ b/uast/diff/testdata/19_src.uast @@ -0,0 +1,234 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 49, + line: 4, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 4, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 24, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 15, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 88, + line: 4, + col: 45, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 92, + line: 7, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 127, + line: 9, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 133, + line: 9, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 150, + line: 9, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 9, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 9, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/1_dst.uast b/uast/diff/testdata/1_dst.uast new file mode 100644 index 00000000..4c15dc9b --- /dev/null +++ b/uast/diff/testdata/1_dst.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/1_src.uast b/uast/diff/testdata/1_src.uast new file mode 100644 index 00000000..ba157e75 --- /dev/null +++ b/uast/diff/testdata/1_src.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 2, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/20_dst.uast b/uast/diff/testdata/20_dst.uast new file mode 100644 index 00000000..dcea5f8e --- /dev/null +++ b/uast/diff/testdata/20_dst.uast @@ -0,0 +1,323 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/20_src.uast b/uast/diff/testdata/20_src.uast new file mode 100644 index 00000000..58ffeb04 --- /dev/null +++ b/uast/diff/testdata/20_src.uast @@ -0,0 +1,498 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 234, + line: 10, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 267, + line: 11, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 266, + line: 11, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 11, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "debug", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 11, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 281, + line: 11, + col: 23, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 10, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 10, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 10, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 10, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/21_dst.uast b/uast/diff/testdata/21_dst.uast new file mode 100644 index 00000000..252a6453 --- /dev/null +++ b/uast/diff/testdata/21_dst.uast @@ -0,0 +1,472 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 9, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 258, + line: 10, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 261, + line: 10, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + end: { '@type': "uast:Position", + offset: 260, + line: 10, + col: 6, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 10, + col: 3, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 9, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 243, + line: 9, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 9, + col: 24, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 9, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 241, + line: 9, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/21_src.uast b/uast/diff/testdata/21_src.uast new file mode 100644 index 00000000..dcea5f8e --- /dev/null +++ b/uast/diff/testdata/21_src.uast @@ -0,0 +1,323 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "simple_page", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "simple_page.simple_page", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 76, + line: 4, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 4, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 84, + line: 4, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 5, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 99, + line: 5, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 95, + line: 5, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 7, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 206, + line: 7, + col: 35, + }, + }, + Name: "simple_page", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 7, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 7, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 175, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 7, + col: 1, + }, + }, + Name: "register_blueprint", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 7, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 227, + line: 7, + col: 56, + }, + }, + Format: "", + Value: "/pages", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/22_dst.uast b/uast/diff/testdata/22_dst.uast new file mode 100644 index 00000000..c4d9c2af --- /dev/null +++ b/uast/diff/testdata/22_dst.uast @@ -0,0 +1,1996 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "pytest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 283, + line: 17, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 17, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 19, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 20, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 395, + line: 20, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 407, + line: 21, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 422, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 21, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 21, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 21, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 21, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 21, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 22, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 22, + col: 13, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 22, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 22, + col: 9, + }, + }, + Name: "testing", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 468, + line: 24, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 26, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 26, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 26, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 565, + line: 26, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 26, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 26, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 26, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 543, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 548, + line: 26, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 547, + line: 26, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 548, + line: 26, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 26, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 26, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 596, + line: 27, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 27, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 595, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 27, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 27, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 595, + line: 27, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 589, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 594, + line: 27, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 627, + line: 28, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 634, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 638, + line: 28, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 30, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 31, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 707, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 31, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 31, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 31, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 31, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 31, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 32, + col: 23, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 32, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 32, + col: 13, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 32, + col: 44, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 32, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 805, + line: 32, + col: 77, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 30, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 30, + col: 40, + }, + }, + Name: "catch_deprecation_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 685, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 30, + col: 54, + }, + }, + Name: "captured", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 822, + line: 34, + col: 15, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 34, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 34, + col: 34, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 34, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 34, + col: 28, + }, + }, + Name: "captured", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 34, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 19, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 19, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 19, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 19, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 19, + col: 59, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 19, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 352, + line: 19, + col: 59, + }, + }, + Name: "catch_deprecation_warnings", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 36, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 36, + col: 28, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 37, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 37, + col: 43, + }, + }, + Format: "", + Value: "Request.module is deprecated", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 38, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 12, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 975, + line: 38, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 983, + line: 38, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 964, + line: 38, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 20, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 963, + line: 38, + col: 15, + }, + }, + Name: "Flask", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 994, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 997, + line: 39, + col: 13, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 996, + line: 39, + col: 12, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 39, + col: 9, + }, + }, + Name: "testing", + }, + ], + }, + ], + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Boolean, Expression, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1007, + line: 39, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1011, + line: 39, + col: 27, + }, + }, + value: true, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1021, + line: 41, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1070, + line: 43, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1076, + line: 43, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1101, + line: 43, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 43, + col: 48, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1078, + line: 43, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 43, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1082, + line: 43, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1083, + line: 43, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1090, + line: 43, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 43, + col: 20, + }, + }, + Name: "module", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1118, + line: 44, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1124, + line: 44, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1125, + line: 44, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1129, + line: 44, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1139, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1143, + line: 46, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1198, + line: 47, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1198, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1199, + line: 47, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 47, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1206, + line: 47, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1205, + line: 47, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1202, + line: 47, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 48, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1241, + line: 48, + col: 22, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1233, + line: 48, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1234, + line: 48, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 48, + col: 14, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1232, + line: 48, + col: 13, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 46, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 46, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1170, + line: 46, + col: 40, + }, + }, + Name: "catch_deprecation_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 46, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 1184, + line: 46, + col: 54, + }, + }, + Name: "captured", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1252, + line: 50, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1258, + line: 50, + col: 15, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1276, + line: 50, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1277, + line: 50, + col: 34, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1263, + line: 50, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1271, + line: 50, + col: 28, + }, + }, + Name: "captured", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 50, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 50, + col: 19, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 871, + line: 36, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 36, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 871, + line: 36, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 875, + line: 36, + col: 33, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 877, + line: 36, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 61, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 877, + line: 36, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 61, + }, + }, + Name: "catch_deprecation_warnings", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/22_src.uast b/uast/diff/testdata/22_src.uast new file mode 100644 index 00000000..a72025ea --- /dev/null +++ b/uast/diff/testdata/22_src.uast @@ -0,0 +1,33 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/23_dst.uast b/uast/diff/testdata/23_dst.uast new file mode 100644 index 00000000..cca08a32 --- /dev/null +++ b/uast/diff/testdata/23_dst.uast @@ -0,0 +1,342 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + Name: "frontend", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 3, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 77, + line: 3, + col: 32, + }, + }, + Format: "", + Value: "frontend", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 3, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 3, + col: 42, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 21, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 105, + line: 3, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 116, + line: 3, + col: 71, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 120, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 158, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 181, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 8, + col: 49, + }, + }, + Format: "", + Value: "frontend/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 180, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 11, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "missing_template", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 13, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 13, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 13, + col: 51, + }, + }, + Format: "", + Value: "missing_template.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 13, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/23_src.uast b/uast/diff/testdata/23_src.uast new file mode 100644 index 00000000..cca08a32 --- /dev/null +++ b/uast/diff/testdata/23_src.uast @@ -0,0 +1,342 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + Name: "frontend", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 3, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 77, + line: 3, + col: 32, + }, + }, + Format: "", + Value: "frontend", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 79, + line: 3, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 3, + col: 42, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 21, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 105, + line: 3, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 116, + line: 3, + col: 71, + }, + }, + Format: "", + Value: "templates", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 120, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 158, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 181, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 8, + col: 49, + }, + }, + Format: "", + Value: "frontend/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 165, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 180, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 11, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "missing_template", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 13, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 13, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 13, + col: 51, + }, + }, + Format: "", + Value: "missing_template.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 284, + line: 13, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/24_dst.uast b/uast/diff/testdata/24_dst.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/24_dst.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/24_src.uast b/uast/diff/testdata/24_src.uast new file mode 100644 index 00000000..a9d72176 --- /dev/null +++ b/uast/diff/testdata/24_src.uast @@ -0,0 +1,325 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 27, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 3, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 3, + col: 48, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 132, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 155, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 173, + line: 8, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 11, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 13, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 226, + line: 13, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 13, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 13, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 226, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/25_dst.uast b/uast/diff/testdata/25_dst.uast new file mode 100644 index 00000000..f2f9dffc --- /dev/null +++ b/uast/diff/testdata/25_dst.uast @@ -0,0 +1,325 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 49, + line: 4, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 4, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 24, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 15, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 88, + line: 4, + col: 45, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 92, + line: 7, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 127, + line: 9, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 133, + line: 9, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 150, + line: 9, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 9, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 9, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 172, + line: 12, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 220, + line: 14, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 14, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 14, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/25_src.uast b/uast/diff/testdata/25_src.uast new file mode 100644 index 00000000..9e4790ed --- /dev/null +++ b/uast/diff/testdata/25_src.uast @@ -0,0 +1,234 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 44, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 49, + line: 4, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 4, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 24, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 52, + line: 4, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 4, + col: 15, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 88, + line: 4, + col: 45, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 92, + line: 7, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 127, + line: 9, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 133, + line: 9, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 150, + line: 9, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 168, + line: 9, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 134, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 9, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/26_dst.uast b/uast/diff/testdata/26_dst.uast new file mode 100644 index 00000000..ba81ec71 --- /dev/null +++ b/uast/diff/testdata/26_dst.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "cli", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 288, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/26_src.uast b/uast/diff/testdata/26_src.uast new file mode 100644 index 00000000..498d7101 --- /dev/null +++ b/uast/diff/testdata/26_src.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "run", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 288, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/27_dst.uast b/uast/diff/testdata/27_dst.uast new file mode 100644 index 00000000..19d7aea6 --- /dev/null +++ b/uast/diff/testdata/27_dst.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../cli", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 289, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/27_src.uast b/uast/diff/testdata/27_src.uast new file mode 100644 index 00000000..ba81ec71 --- /dev/null +++ b/uast/diff/testdata/27_src.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "cli", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 288, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/28_dst.uast b/uast/diff/testdata/28_dst.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/28_dst.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/28_src.uast b/uast/diff/testdata/28_src.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/28_src.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/29_dst.uast b/uast/diff/testdata/29_dst.uast new file mode 100644 index 00000000..13c01925 --- /dev/null +++ b/uast/diff/testdata/29_dst.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../cli", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 289, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/29_src.uast b/uast/diff/testdata/29_src.uast new file mode 100644 index 00000000..19d7aea6 --- /dev/null +++ b/uast/diff/testdata/29_src.uast @@ -0,0 +1,210 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.__main__\n ~~~~~~~~~~~~~~\n\n Alias for flask.run for the command line.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 13, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../cli", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 15, + col: 9, + }, + }, + Name: "main", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "as_module", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 285, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 289, + line: 15, + col: 24, + }, + }, + value: true, + }, + }, + ], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 216, + line: 13, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 13, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/2_dst.uast b/uast/diff/testdata/2_dst.uast new file mode 100644 index 00000000..c64b255e --- /dev/null +++ b/uast/diff/testdata/2_dst.uast @@ -0,0 +1,155 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 27, + line: 2, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 36, + line: 2, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 53, + line: 2, + col: 30, + }, + }, + Format: "", + Value: "yourapplication", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 2, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 4, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "yourapplication.views", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + lines: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/2_src.uast b/uast/diff/testdata/2_src.uast new file mode 100644 index 00000000..a62a1070 --- /dev/null +++ b/uast/diff/testdata/2_src.uast @@ -0,0 +1,154 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 27, + line: 2, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 36, + line: 2, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 44, + line: 2, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 2, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "yourapplication.views", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + lines: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/30_dst.uast b/uast/diff/testdata/30_dst.uast new file mode 100644 index 00000000..91041ad0 --- /dev/null +++ b/uast/diff/testdata/30_dst.uast @@ -0,0 +1,757 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "print_function", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 86, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 6, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 104, + line: 7, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 110, + line: 7, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 111, + line: 7, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 7, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 122, + line: 7, + col: 23, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 111, + line: 7, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 116, + line: 7, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 130, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 141, + line: 10, + col: 16, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 163, + line: 11, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 11, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 170, + line: 11, + col: 18, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 179, + line: 11, + col: 27, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 180, + line: 11, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 186, + line: 11, + col: 34, + }, + }, + Format: "", + Value: "app2", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 188, + line: 11, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 11, + col: 39, + }, + }, + Name: "foo", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 193, + line: 11, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 11, + col: 44, + }, + }, + Name: "bar", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 171, + line: 11, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 11, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 170, + line: 11, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 173, + line: 11, + col: 21, + }, + }, + Format: "", + Value: "_", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 170, + line: 11, + col: 18, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 11, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 169, + line: 11, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 10, + col: 20, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 10, + col: 20, + }, + }, + Name: "foo", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 147, + line: 10, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 150, + line: 10, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 147, + line: 10, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 150, + line: 10, + col: 25, + }, + }, + Name: "bar", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 217, + line: 14, + col: 16, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app3", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 15, + col: 18, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 15, + col: 27, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 270, + line: 15, + col: 34, + }, + }, + Format: "", + Value: "app3", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 272, + line: 15, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 39, + }, + }, + Name: "foo", + }, + { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 41, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 15, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 300, + line: 15, + col: 64, + }, + }, + Format: "", + Value: "test", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 278, + line: 15, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 289, + line: 15, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 288, + line: 15, + col: 52, + }, + }, + Name: "script_info", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 41, + }, + }, + Name: "data", + }, + ], + }, + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 15, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 15, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 15, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 15, + col: 21, + }, + }, + Format: "", + Value: "_", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 15, + col: 18, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 15, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 20, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 20, + }, + }, + Name: "foo", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 234, + line: 14, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 234, + line: 14, + col: 33, + }, + }, + Name: "script_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/30_src.uast b/uast/diff/testdata/30_src.uast new file mode 100644 index 00000000..8e1a0fff --- /dev/null +++ b/uast/diff/testdata/30_src.uast @@ -0,0 +1,731 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "absolute_import", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "print_function", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 86, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 6, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 104, + line: 7, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 110, + line: 7, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 111, + line: 7, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 7, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 129, + line: 7, + col: 30, + }, + }, + Format: "", + Value: "create_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 111, + line: 7, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 116, + line: 7, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 137, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 10, + col: 16, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 164, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 11, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 171, + line: 11, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 11, + col: 18, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 11, + col: 27, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 187, + line: 11, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 200, + line: 11, + col: 41, + }, + }, + Format: "", + Value: "create_app2", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 202, + line: 11, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 205, + line: 11, + col: 46, + }, + }, + Name: "foo", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 11, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 210, + line: 11, + col: 51, + }, + }, + Name: "bar", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 11, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 181, + line: 11, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 11, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 180, + line: 11, + col: 21, + }, + }, + Format: "", + Value: "_", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 11, + col: 18, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 171, + line: 11, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 11, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 149, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 152, + line: 10, + col: 20, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 149, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 152, + line: 10, + col: 20, + }, + }, + Name: "foo", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 154, + line: 10, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 157, + line: 10, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 154, + line: 10, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 157, + line: 10, + col: 25, + }, + }, + Name: "bar", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 231, + line: 14, + col: 16, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "create_app3", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 266, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 267, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 18, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 282, + line: 15, + col: 27, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 41, + }, + }, + Format: "", + Value: "create_app3", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 15, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 301, + line: 15, + col: 46, + }, + }, + Name: "foo", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 303, + line: 15, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 306, + line: 15, + col: 51, + }, + }, + Name: "bar", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 274, + line: 15, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 15, + col: 21, + }, + }, + Format: "", + Value: "_", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 273, + line: 15, + col: 18, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 267, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 272, + line: 15, + col: 17, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 232, + line: 14, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 235, + line: 14, + col: 20, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 232, + line: 14, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 235, + line: 14, + col: 20, + }, + }, + Name: "foo", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 25, + }, + }, + Name: "bar", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 38, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 38, + }, + }, + Name: "script_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/31_dst.uast b/uast/diff/testdata/31_dst.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/31_dst.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/31_src.uast b/uast/diff/testdata/31_src.uast new file mode 100644 index 00000000..a9d72176 --- /dev/null +++ b/uast/diff/testdata/31_src.uast @@ -0,0 +1,325 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 27, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 85, + line: 3, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 3, + col: 48, + }, + }, + Format: "", + Value: "/admin", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 132, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 155, + line: 8, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 173, + line: 8, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 11, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 13, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 226, + line: 13, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 13, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 13, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 226, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/32_dst.uast b/uast/diff/testdata/32_dst.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/32_dst.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/32_src.uast b/uast/diff/testdata/32_src.uast new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/uast/diff/testdata/32_src.uast @@ -0,0 +1,392 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 51, + line: 3, + col: 6, + }, + }, + Name: "admin", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 3, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 71, + line: 3, + col: 26, + }, + }, + Format: "", + Value: "admin", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 3, + col: 36, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 18, + }, + }, + Name: "Blueprint", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url_prefix", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 102, + line: 3, + col: 57, + }, + }, + Format: "", + Value: "/admin", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "template_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 138, + line: 4, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 149, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "templates", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "static_folder", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 5, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 191, + line: 5, + col: 41, + }, + }, + Format: "", + Value: "static", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 195, + line: 8, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 236, + line: 10, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 271, + line: 10, + col: 46, + }, + }, + Format: "", + Value: "admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 252, + line: 10, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 13, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index2", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 15, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 340, + line: 15, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 15, + col: 48, + }, + }, + Format: "", + Value: "./admin/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 339, + line: 15, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/33_dst.uast b/uast/diff/testdata/33_dst.uast new file mode 100644 index 00000000..22c066a0 --- /dev/null +++ b/uast/diff/testdata/33_dst.uast @@ -0,0 +1,306 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 191, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 194, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n Flaskr Tests\n ~~~~~~~~~~~~\n\n Tests the Flaskr application.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 211, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "find_packages", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 14, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 15, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 15, + col: 18, + }, + }, + Format: "", + Value: "flaskr", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "packages", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 280, + line: 16, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 280, + line: 16, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 27, + }, + }, + Name: "find_packages", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "include_package_data", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 322, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 326, + line: 17, + col: 30, + }, + }, + value: true, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 18, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 366, + line: 19, + col: 16, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "setup_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 394, + line: 21, + col: 20, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 419, + line: 22, + col: 24, + }, + }, + Format: "", + Value: "pytest-runner", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "tests_require", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 24, + col: 19, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 25, + col: 17, + }, + }, + Format: "", + Value: "pytest", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/33_src.uast b/uast/diff/testdata/33_src.uast new file mode 100644 index 00000000..2de71353 --- /dev/null +++ b/uast/diff/testdata/33_src.uast @@ -0,0 +1,273 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 3, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 4, + col: 18, + }, + }, + Format: "", + Value: "flaskr", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "packages", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 69, + line: 5, + col: 14, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 78, + line: 5, + col: 23, + }, + }, + Format: "", + Value: "flaskr", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "include_package_data", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 30, + }, + }, + value: true, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 7, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 8, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 150, + line: 8, + col: 16, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "setup_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 10, + col: 20, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 188, + line: 11, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 203, + line: 11, + col: 24, + }, + }, + Format: "", + Value: "pytest-runner", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "tests_require", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 19, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 14, + col: 17, + }, + }, + Format: "", + Value: "pytest", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/34_dst.uast b/uast/diff/testdata/34_dst.uast new file mode 100644 index 00000000..ab914d3a --- /dev/null +++ b/uast/diff/testdata/34_dst.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 12, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 12, + col: 21, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 361, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/34_src.uast b/uast/diff/testdata/34_src.uast new file mode 100644 index 00000000..5b66c62b --- /dev/null +++ b/uast/diff/testdata/34_src.uast @@ -0,0 +1,416 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 12, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 12, + col: 21, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 361, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 444, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 16, + col: 24, + }, + }, + Format: "", + Value: "Werkzeug==dev", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 17, + col: 22, + }, + }, + Format: "", + Value: "Jinja2==dev", + }, + ], + 'noops_sameline': { '@type': "SameLineNoops", + '@role': [Comment], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 15, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 434, + line: 15, + col: 72, + }, + }, + 'noop_lines': [ + { '@type': "uast:Comment", + '@pos': { '@type': "uast:Positions", + }, + Block: false, + Prefix: "# ", + Suffix: "", + Tab: "", + Text: "yes, as of now we need the development versions", + }, + ], + }, + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/35_dst.uast b/uast/diff/testdata/35_dst.uast new file mode 100644 index 00000000..bba29577 --- /dev/null +++ b/uast/diff/testdata/35_dst.uast @@ -0,0 +1,390 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 16, + col: 26, + }, + }, + Format: "", + Value: "Werkzeug>=0.6.1", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 17, + col: 22, + }, + }, + Format: "", + Value: "Jinja2>=2.4", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/35_src.uast b/uast/diff/testdata/35_src.uast new file mode 100644 index 00000000..84b34cd6 --- /dev/null +++ b/uast/diff/testdata/35_src.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/36_dst.uast b/uast/diff/testdata/36_dst.uast new file mode 100644 index 00000000..cee2fe48 --- /dev/null +++ b/uast/diff/testdata/36_dst.uast @@ -0,0 +1,255 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: true, + Names: ~, + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/36_src.uast b/uast/diff/testdata/36_src.uast new file mode 100644 index 00000000..7775525f --- /dev/null +++ b/uast/diff/testdata/36_src.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1165, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1176, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1190, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1193, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1198, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1201, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1204, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1207, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1214, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1227, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1236, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1249, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1254, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1263, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1268, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/37_dst.uast b/uast/diff/testdata/37_dst.uast new file mode 100644 index 00000000..7e9b1c8c --- /dev/null +++ b/uast/diff/testdata/37_dst.uast @@ -0,0 +1,589 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 39, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 672, + line: 39, + col: 4, + }, + }, + Format: "", + Value: "\nFlask\n-----\n\nFlask is a microframework for Python based on Werkzeug, Jinja 2 and good\nintentions. And before you ask: It's BSD licensed!\n\nFlask is Fun\n````````````\n\n::\n\n from flask import Flask\n app = Flask(__name__)\n\n @app.route(\"/\")\n def hello():\n return \"Hello World!\"\n\n if __name__ == \"__main__\":\n app.run()\n\nAnd Easy to Setup\n`````````````````\n\n::\n\n $ easy_install Flask\n $ python hello.py\n * Running on http://localhost:5000/\n\nLinks\n`````\n\n* `website `_\n* `documentation `_\n* `development version `_\n\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 688, + line: 40, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 704, + line: 43, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 704, + line: 43, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 704, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 709, + line: 43, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 44, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 727, + line: 44, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 741, + line: 45, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 746, + line: 45, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 756, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 792, + line: 46, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 806, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 47, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 48, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 48, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 49, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 888, + line: 49, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 906, + line: 50, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 970, + line: 50, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "long_description", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 51, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1000, + line: 51, + col: 29, + }, + }, + Name: "__doc__", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1017, + line: 52, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1018, + line: 52, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1025, + line: 52, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1041, + line: 53, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1046, + line: 53, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1062, + line: 54, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 54, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1090, + line: 55, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1100, + line: 56, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1117, + line: 56, + col: 26, + }, + }, + Format: "", + Value: "Werkzeug>=0.6.1", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1127, + line: 57, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1140, + line: 57, + col: 22, + }, + }, + Format: "", + Value: "Jinja2>=2.4", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "classifiers", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 59, + col: 17, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 60, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1207, + line: 60, + col: 42, + }, + }, + Format: "", + Value: "Development Status :: 3 - Alpha", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1217, + line: 61, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1249, + line: 61, + col: 41, + }, + }, + Format: "", + Value: "Environment :: Web Environment", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1259, + line: 62, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1292, + line: 62, + col: 42, + }, + }, + Format: "", + Value: "Intended Audience :: Developers", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1302, + line: 63, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1342, + line: 63, + col: 49, + }, + }, + Format: "", + Value: "License :: OSI Approved :: BSD License", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1352, + line: 64, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1388, + line: 64, + col: 45, + }, + }, + Format: "", + Value: "Operating System :: OS Independent", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1398, + line: 65, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1430, + line: 65, + col: 41, + }, + }, + Format: "", + Value: "Programming Language :: Python", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1440, + line: 66, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1490, + line: 66, + col: 59, + }, + }, + Format: "", + Value: "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1500, + line: 67, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1562, + line: 67, + col: 71, + }, + }, + Format: "", + Value: "Topic :: Software Development :: Libraries :: Python Modules", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/37_src.uast b/uast/diff/testdata/37_src.uast new file mode 100644 index 00000000..bba29577 --- /dev/null +++ b/uast/diff/testdata/37_src.uast @@ -0,0 +1,390 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 16, + col: 26, + }, + }, + Format: "", + Value: "Werkzeug>=0.6.1", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 17, + col: 22, + }, + }, + Format: "", + Value: "Jinja2>=2.4", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/38_dst.uast b/uast/diff/testdata/38_dst.uast new file mode 100644 index 00000000..d92632c7 --- /dev/null +++ b/uast/diff/testdata/38_dst.uast @@ -0,0 +1,255 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: true, + Names: ~, + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/38_src.uast b/uast/diff/testdata/38_src.uast new file mode 100644 index 00000000..cee2fe48 --- /dev/null +++ b/uast/diff/testdata/38_src.uast @@ -0,0 +1,255 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: true, + Names: ~, + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/39_dst.uast b/uast/diff/testdata/39_dst.uast new file mode 100644 index 00000000..5f90c94a --- /dev/null +++ b/uast/diff/testdata/39_dst.uast @@ -0,0 +1,272 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "NullSession", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 415, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 435, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 435, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/39_src.uast b/uast/diff/testdata/39_src.uast new file mode 100644 index 00000000..d92632c7 --- /dev/null +++ b/uast/diff/testdata/39_src.uast @@ -0,0 +1,255 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 258, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n This module used to flask with the session global so we moved it\n over to flask.sessions\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "warn", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "warnings", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 14, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 14, + col: 60, + }, + }, + Format: "", + Value: "please use flask.sessions instead", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 291, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 14, + col: 24, + }, + }, + Name: "DeprecationWarning", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 14, + col: 5, + }, + }, + Name: "warn", + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 363, + line: 16, + col: 15, + }, + }, + All: true, + Names: ~, + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 18, + col: 8, + }, + }, + Name: "Session", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 30, + }, + }, + Name: "SecureCookieSession", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 19, + col: 13, + }, + }, + Name: "_NullSession", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 19, + col: 27, + }, + }, + Name: "NullSession", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/3_dst.uast b/uast/diff/testdata/3_dst.uast new file mode 100644 index 00000000..5e167c2e --- /dev/null +++ b/uast/diff/testdata/3_dst.uast @@ -0,0 +1,187 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 58, + line: 3, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 10, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 65, + line: 3, + col: 9, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 38, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 3, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 117, + line: 3, + col: 61, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/3_src.uast b/uast/diff/testdata/3_src.uast new file mode 100644 index 00000000..d869f711 --- /dev/null +++ b/uast/diff/testdata/3_src.uast @@ -0,0 +1,3263 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "sys", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 11, + line: 2, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 3, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "TestLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "unittest.loader", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 101, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 101, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 6, + col: 14, + }, + }, + Name: "common_prefix", + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 17, + }, + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 118, + line: 6, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 22, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 17, + }, + }, + Name: "__module__", + }, + ], + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 23, + }, + }, + Format: "", + Value: ".", + }, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 146, + line: 9, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 160, + line: 9, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "find_all_tests", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 168, + line: 10, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 168, + line: 10, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 10, + col: 11, + }, + }, + Name: "suites", + }, + ], + value: { '@type': "List", + '@role': [Expression, List, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 177, + line: 10, + col: 14, + }, + }, + ctx: "Load", + elts: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 10, + col: 15, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 10, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 183, + line: 10, + col: 20, + }, + }, + Name: "suite", + }, + keywords: [], + }, + ], + }, + }, + { '@type': "While", + '@token': "while", + '@role': [Statement, While], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 191, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 11, + col: 10, + }, + }, + body: { '@type': "For.body", + '@role': [Body, Then, While], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 12, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 213, + line: 12, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 12, + col: 10, + }, + }, + Name: "s", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 12, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 12, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 12, + col: 19, + }, + }, + Name: "suites", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 217, + line: 12, + col: 13, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 12, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 14, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 14, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 270, + line: 14, + col: 28, + }, + }, + Name: "s", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 14, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 14, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 14, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 261, + line: 14, + col: 19, + }, + }, + Name: "suites", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 255, + line: 14, + col: 13, + }, + }, + Name: "extend", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 280, + line: 15, + col: 9, + }, + }, + '@token': ~, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 13, + }, + }, + value: { '@type': "Yield", + '@token': "yield", + '@role': [Incomplete, Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 315, + line: 16, + col: 18, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 16, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 20, + }, + }, + Name: "s", + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 287, + line: 15, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 25, + }, + }, + Name: "TypeError", + }, + }, + ], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + ], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, While], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, While], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 197, + line: 11, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 203, + line: 11, + col: 17, + }, + }, + Name: "suites", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 19, + col: 29, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "find_all_tests_with_name", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "For", + '@token': "for", + '@role': [For, Iterator, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 20, + col: 8, + }, + }, + body: { '@type': "For.body", + '@role': [Body, For, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 9, + }, + }, + value: { '@type': "Yield", + '@token': "yield", + '@role': [Incomplete, Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 21, + col: 14, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 15, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 21, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 21, + col: 23, + }, + }, + Name: "testcase", + }, + { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 21, + col: 25, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 21, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 21, + col: 35, + }, + }, + Format: "", + Value: "%s.%s.%s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Tuple", + '@role': [Binary, Expression, Literal, Primitive, Right, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 22, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 442, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 22, + col: 21, + }, + }, + Name: "testcase", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 22, + col: 31, + }, + }, + Name: "__class__", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 22, + col: 13, + }, + }, + Name: "__module__", + }, + ], + }, + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 23, + col: 21, + }, + }, + Name: "testcase", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 502, + line: 23, + col: 31, + }, + }, + Name: "__class__", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 23, + col: 13, + }, + }, + Name: "__name__", + }, + ], + }, + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 24, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 24, + col: 21, + }, + }, + Name: "testcase", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 13, + }, + }, + Name: "_testMethodName", + }, + ], + }, + ], + }, + }, + ], + }, + }, + }, + ], + }, + iter: { '@type': "Call", + '@role': [Call, Expression, For, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 20, + col: 21, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 20, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 20, + col: 35, + }, + }, + Name: "find_all_tests", + }, + keywords: [], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, For], + 'else_stmts': [], + }, + target: { '@type': "uast:Identifier", + '@role': [For, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 360, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 17, + }, + }, + Name: "testcase", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "ClassDef", + '@token': "BetterLoader", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 568, + line: 28, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 580, + line: 28, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 28, + col: 30, + }, + }, + Name: "TestLoader", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 620, + line: 30, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "loadTestsFromName", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 31, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 32, + col: 19, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 32, + col: 20, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 32, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 32, + col: 25, + }, + }, + Name: "suite", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 658, + line: 31, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 31, + col: 27, + }, + }, + Format: "", + Value: "suite", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 658, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 662, + line: 31, + col: 16, + }, + }, + Name: "name", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "For", + '@token': "for", + '@role': [For, Iterator, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 710, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 713, + line: 33, + col: 12, + }, + }, + body: { '@type': "For.body", + '@role': [Body, For, Then], + 'body_stmts': [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 778, + line: 34, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 813, + line: 35, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 35, + col: 23, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 820, + line: 35, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 828, + line: 35, + col: 32, + }, + }, + Name: "testcase", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 34, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 795, + line: 34, + col: 32, + }, + }, + Name: "name", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 779, + line: 34, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 787, + line: 34, + col: 24, + }, + }, + Name: "testname", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 841, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 36, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 37, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 898, + line: 37, + col: 19, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 958, + line: 38, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 38, + col: 27, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 965, + line: 38, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 38, + col: 36, + }, + }, + Name: "testcase", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 37, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 932, + line: 37, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 936, + line: 37, + col: 57, + }, + }, + Name: "name", + }, + ], + }, + left: { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 37, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 37, + col: 29, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 46, + }, + }, + Name: "common_prefix", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 908, + line: 37, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 911, + line: 37, + col: 32, + }, + }, + Name: "len", + }, + keywords: [], + }, + step: ~, + upper: ~, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 37, + col: 28, + }, + }, + Name: "testname", + }, + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 844, + line: 36, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 36, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 877, + line: 36, + col: 49, + }, + }, + Name: "common_prefix", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 36, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 853, + line: 36, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 844, + line: 36, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 36, + col: 24, + }, + }, + Name: "testname", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 844, + line: 36, + col: 16, + }, + }, + Name: "startswith", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + iter: { '@type': "Call", + '@role': [Call, Expression, For, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 33, + col: 35, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 736, + line: 33, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 33, + col: 59, + }, + }, + Name: "find_all_tests_with_name", + }, + keywords: [], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, For], + 'else_stmts': [], + }, + target: { '@type': "Tuple", + '@role': [Expression, For, Literal, Primitive, Tuple, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 33, + col: 13, + }, + }, + ctx: "Store", + elts: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 33, + col: 21, + }, + }, + Name: "testcase", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 33, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 732, + line: 33, + col: 31, + }, + }, + Name: "testname", + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 40, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 983, + line: 40, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 992, + line: 40, + col: 18, + }, + }, + Name: "all_tests", + }, + ], + value: { '@type': "List", + '@role': [Expression, List, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 995, + line: 40, + col: 21, + }, + }, + ctx: "Load", + elts: [], + }, + }, + { '@type': "For", + '@token': "for", + '@role': [For, Iterator, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1006, + line: 41, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1009, + line: 41, + col: 12, + }, + }, + body: { '@type': "For.body", + '@role': [Body, For, Then], + 'body_stmts': [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1072, + line: 42, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1074, + line: 42, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1208, + line: 44, + col: 17, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1208, + line: 44, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1225, + line: 44, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1233, + line: 44, + col: 42, + }, + }, + Name: "testcase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1209, + line: 44, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1218, + line: 44, + col: 27, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1208, + line: 44, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1217, + line: 44, + col: 26, + }, + }, + Name: "all_tests", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1208, + line: 44, + col: 17, + }, + }, + Name: "append", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "BoolOp", + '@role': [Boolean, Condition, If, Incomplete, Literal], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1075, + line: 42, + col: 16, + }, + }, + op: { '@type': "Or", + '@token': "or", + '@role': [Boolean, Operator, Or], + '@pos': { '@type': "uast:Positions", + }, + }, + values: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1075, + line: 42, + col: 16, + }, + }, + args: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1093, + line: 42, + col: 34, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1083, + line: 42, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 42, + col: 25, + }, + }, + Format: "", + Value: ".", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1099, + line: 42, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1103, + line: 42, + col: 44, + }, + }, + Name: "name", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 42, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1084, + line: 42, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1075, + line: 42, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1083, + line: 42, + col: 24, + }, + }, + Name: "testname", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1075, + line: 42, + col: 16, + }, + }, + Name: "endswith", + }, + ], + }, + keywords: [], + }, + { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1108, + line: 42, + col: 49, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1130, + line: 42, + col: 71, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 42, + col: 79, + }, + }, + Name: "testname", + }, + ], + }, + left: { '@type': "BinOp", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1120, + line: 42, + col: 61, + }, + }, + left: { '@type': "BinOp", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 42, + col: 50, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1093, + line: 42, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1096, + line: 42, + col: 37, + }, + }, + Format: "", + Value: ".", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1115, + line: 42, + col: 56, + }, + end: { '@type': "uast:Position", + offset: 1119, + line: 42, + col: 60, + }, + }, + Name: "name", + }, + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1109, + line: 42, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1112, + line: 42, + col: 53, + }, + }, + Format: "", + Value: ".", + }, + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1159, + line: 43, + col: 16, + }, + }, + args: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 43, + col: 36, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 43, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1183, + line: 43, + col: 40, + }, + }, + Name: "name", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1167, + line: 43, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 43, + col: 25, + }, + }, + Format: "", + Value: ".", + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1160, + line: 43, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 43, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1159, + line: 43, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1167, + line: 43, + col: 24, + }, + }, + Name: "testname", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1159, + line: 43, + col: 16, + }, + }, + Name: "startswith", + }, + ], + }, + keywords: [], + }, + ], + }, + }, + ], + }, + iter: { '@type': "Call", + '@role': [Call, Expression, For, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 41, + col: 35, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1032, + line: 41, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 1056, + line: 41, + col: 59, + }, + }, + Name: "find_all_tests_with_name", + }, + keywords: [], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, For], + 'else_stmts': [], + }, + target: { '@type': "Tuple", + '@role': [Expression, For, Literal, Primitive, Tuple, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 41, + col: 13, + }, + }, + ctx: "Store", + elts: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1010, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1018, + line: 41, + col: 21, + }, + }, + Name: "testcase", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1020, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1028, + line: 41, + col: 31, + }, + }, + Name: "testname", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1244, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1246, + line: 46, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1274, + line: 47, + col: 13, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1274, + line: 47, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1274, + line: 47, + col: 13, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1274, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1279, + line: 47, + col: 18, + }, + }, + Name: "print", + }, + op: { '@type': "RShift", + '@token': ">>", + '@role': [Binary, Bitwise, Operator, RightShift], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1284, + line: 47, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1287, + line: 47, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1283, + line: 47, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1286, + line: 47, + col: 25, + }, + }, + Name: "sys", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1283, + line: 47, + col: 22, + }, + }, + Name: "stderr", + }, + ], + }, + }, + { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 47, + col: 34, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1295, + line: 47, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 1337, + line: 47, + col: 76, + }, + }, + Format: "", + Value: "Error: could not find test case for \"%s\"", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1340, + line: 47, + col: 79, + }, + end: { '@type': "uast:Position", + offset: 1344, + line: 47, + col: 83, + }, + }, + Name: "name", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1357, + line: 48, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1357, + line: 48, + col: 13, + }, + }, + args: [ + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1366, + line: 48, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1367, + line: 48, + col: 23, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1358, + line: 48, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1361, + line: 48, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1357, + line: 48, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1360, + line: 48, + col: 16, + }, + }, + Name: "sys", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1357, + line: 48, + col: 13, + }, + }, + Name: "exit", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "UnaryOp", + '@role': [Boolean, Condition, Expression, If, Operator, Unary], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1247, + line: 46, + col: 12, + }, + }, + op: { '@type': "Not", + '@token': "not", + '@role': [Boolean, Not, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + operand: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1251, + line: 46, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1260, + line: 46, + col: 25, + }, + }, + Name: "all_tests", + }, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1378, + line: 50, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1380, + line: 50, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1414, + line: 51, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1420, + line: 51, + col: 19, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1421, + line: 51, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1431, + line: 51, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1432, + line: 51, + col: 31, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1421, + line: 51, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1430, + line: 51, + col: 29, + }, + }, + Name: "all_tests", + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1381, + line: 50, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 1, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1399, + line: 50, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1400, + line: 50, + col: 31, + }, + }, + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1381, + line: 50, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1385, + line: 50, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1394, + line: 50, + col: 25, + }, + }, + Name: "all_tests", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1381, + line: 50, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1384, + line: 50, + col: 15, + }, + }, + Name: "len", + }, + keywords: [], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1442, + line: 52, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1442, + line: 52, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1444, + line: 52, + col: 11, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1447, + line: 52, + col: 14, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1448, + line: 52, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 1456, + line: 52, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1447, + line: 52, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1455, + line: 52, + col: 22, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1447, + line: 52, + col: 14, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "For", + '@token': "for", + '@role': [For, Iterator, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1476, + line: 53, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1479, + line: 53, + col: 12, + }, + }, + body: { '@type': "For.body", + '@role': [Body, For, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1511, + line: 54, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1511, + line: 54, + col: 13, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1522, + line: 54, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1526, + line: 54, + col: 28, + }, + }, + Name: "test", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1512, + line: 54, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 1514, + line: 54, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1511, + line: 54, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1513, + line: 54, + col: 15, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1511, + line: 54, + col: 13, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + iter: { '@type': "uast:Identifier", + '@role': [Expression, For], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1488, + line: 53, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1497, + line: 53, + col: 30, + }, + }, + Name: "all_tests", + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, For], + 'else_stmts': [], + }, + target: { '@type': "uast:Identifier", + '@role': [For, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1480, + line: 53, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1484, + line: 53, + col: 17, + }, + }, + Name: "test", + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1536, + line: 55, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1542, + line: 55, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1543, + line: 55, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1545, + line: 55, + col: 18, + }, + }, + Name: "rv", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 30, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 30, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 30, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 30, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 627, + line: 30, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 30, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 627, + line: 30, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 30, + col: 37, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 30, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 639, + line: 30, + col: 45, + }, + }, + Init: { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 640, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 30, + col: 50, + }, + }, + LiteralValue: "None", + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 594, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 594, + line: 29, + col: 1, + }, + }, + lines: [], + }, + value: ~, + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 30, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 639, + line: 30, + col: 45, + }, + }, + Name: "module", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1548, + line: 58, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1548, + line: 58, + col: 1, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1549, + line: 58, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 1557, + line: 58, + col: 10, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1548, + line: 58, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1556, + line: 58, + col: 9, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1548, + line: 58, + col: 1, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1573, + line: 58, + col: 26, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1573, + line: 58, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 1585, + line: 58, + col: 38, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1601, + line: 58, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 1608, + line: 58, + col: 61, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/40_dst.uast b/uast/diff/testdata/40_dst.uast new file mode 100644 index 00000000..ab914d3a --- /dev/null +++ b/uast/diff/testdata/40_dst.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 12, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 12, + col: 21, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 361, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/40_src.uast b/uast/diff/testdata/40_src.uast new file mode 100644 index 00000000..5b66c62b --- /dev/null +++ b/uast/diff/testdata/40_src.uast @@ -0,0 +1,416 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 12, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 12, + col: 21, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 361, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 444, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 16, + col: 24, + }, + }, + Format: "", + Value: "Werkzeug==dev", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 17, + col: 22, + }, + }, + Format: "", + Value: "Jinja2==dev", + }, + ], + 'noops_sameline': { '@type': "SameLineNoops", + '@role': [Comment], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 385, + line: 15, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 434, + line: 15, + col: 72, + }, + }, + 'noop_lines': [ + { '@type': "uast:Comment", + '@pos': { '@type': "uast:Positions", + }, + Block: false, + Prefix: "# ", + Suffix: "", + Tab: "", + Text: "yes, as of now we need the development versions", + }, + ], + }, + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/41_dst.uast b/uast/diff/testdata/41_dst.uast new file mode 100644 index 00000000..84b34cd6 --- /dev/null +++ b/uast/diff/testdata/41_dst.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/41_src.uast b/uast/diff/testdata/41_src.uast new file mode 100644 index 00000000..ab914d3a --- /dev/null +++ b/uast/diff/testdata/41_src.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 12, + col: 13, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 319, + line: 12, + col: 21, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 335, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 361, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 460, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/42_dst.uast b/uast/diff/testdata/42_dst.uast new file mode 100644 index 00000000..5f515f47 --- /dev/null +++ b/uast/diff/testdata/42_dst.uast @@ -0,0 +1,682 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 264, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 331, + line: 16, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 17, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 17, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 17, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 17, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 371, + line: 17, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 18, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 18, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 18, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 19, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 19, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 520, + line: 19, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 19, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 20, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 20, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 551, + line: 20, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 20, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 20, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 20, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/42_src.uast b/uast/diff/testdata/42_src.uast new file mode 100644 index 00000000..f00b378d --- /dev/null +++ b/uast/diff/testdata/42_src.uast @@ -0,0 +1,656 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 62, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 62, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 80, + line: 4, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 93, + line: 4, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 107, + line: 5, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 5, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 121, + line: 5, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 127, + line: 5, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 130, + line: 5, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 5, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 148, + line: 5, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 151, + line: 5, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 129, + line: 5, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 5, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 164, + line: 6, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 6, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 6, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 184, + line: 6, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 187, + line: 6, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 205, + line: 6, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 204, + line: 6, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 6, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 6, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 6, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 167, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 6, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 7, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 7, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 7, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 7, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 7, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 266, + line: 7, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 7, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 7, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 266, + line: 7, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 7, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 7, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 228, + line: 7, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 238, + line: 7, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 279, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 279, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 8, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 8, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 8, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 300, + line: 8, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 303, + line: 8, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 321, + line: 8, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 8, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 320, + line: 8, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 321, + line: 8, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 8, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 8, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 8, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 8, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/43_dst.uast b/uast/diff/testdata/43_dst.uast new file mode 100644 index 00000000..bba29577 --- /dev/null +++ b/uast/diff/testdata/43_dst.uast @@ -0,0 +1,390 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 16, + col: 26, + }, + }, + Format: "", + Value: "Werkzeug>=0.6.1", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 17, + col: 22, + }, + }, + Format: "", + Value: "Jinja2>=2.4", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/43_src.uast b/uast/diff/testdata/43_src.uast new file mode 100644 index 00000000..84b34cd6 --- /dev/null +++ b/uast/diff/testdata/43_src.uast @@ -0,0 +1,419 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 31, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 36, + line: 4, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 5, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 5, + col: 17, + }, + }, + Format: "", + Value: "Flask", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "version", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 68, + line: 6, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 73, + line: 6, + col: 18, + }, + }, + Format: "", + Value: "0.1", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "url", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 7, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 7, + col: 45, + }, + }, + Format: "", + Value: "http://github.com/mitsuhiko/flask/", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "license", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 138, + line: 8, + col: 18, + }, + }, + Format: "", + Value: "BSD", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 9, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 167, + line: 9, + col: 28, + }, + }, + Format: "", + Value: "Armin Ronacher", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "author_email", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 186, + line: 10, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 47, + }, + }, + Format: "", + Value: "armin.ronacher@active-4.com", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "description", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 11, + col: 81, + }, + }, + Format: "", + Value: "A microframework based on Werkzeug, Jinja2 and good intentions", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "py_modules", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 12, + col: 16, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 12, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 12, + col: 24, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "zip_safe", + }, + value: { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 338, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 343, + line: 13, + col: 19, + }, + }, + value: false, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "platforms", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 14, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 364, + line: 14, + col: 20, + }, + }, + Format: "", + Value: "any", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 22, + }, + }, + ctx: "Load", + elts: [], + }, + }, + ], + }, + }, + ], + 'noops_remainder': { '@type': "RemainderNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 16, + col: 1, + }, + }, + Block: false, + Prefix: "# ", + Suffix: "\n", + Tab: "", + Text: "disabled until release, install yourself", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 17, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Werkzeug',", + }, + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 1, + }, + }, + Block: false, + Prefix: " '", + Suffix: "\n", + Tab: "", + Text: "Jinja2'", + }, + ], + }, +} \ No newline at end of file diff --git a/uast/diff/testdata/44_dst.uast b/uast/diff/testdata/44_dst.uast new file mode 100644 index 00000000..7e8b9dab --- /dev/null +++ b/uast/diff/testdata/44_dst.uast @@ -0,0 +1,997 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 294, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 489, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 576, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 637, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 695, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 686, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 724, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/44_src.uast b/uast/diff/testdata/44_src.uast new file mode 100644 index 00000000..5f515f47 --- /dev/null +++ b/uast/diff/testdata/44_src.uast @@ -0,0 +1,682 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 264, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 331, + line: 16, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 17, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 17, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 17, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 17, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 371, + line: 17, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 18, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 18, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 18, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 19, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 19, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 520, + line: 19, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 19, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 20, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 20, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 551, + line: 20, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 20, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 20, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 20, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/45_dst.uast b/uast/diff/testdata/45_dst.uast new file mode 100644 index 00000000..20511785 --- /dev/null +++ b/uast/diff/testdata/45_dst.uast @@ -0,0 +1,315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/45_src.uast b/uast/diff/testdata/45_src.uast new file mode 100644 index 00000000..5b44b142 --- /dev/null +++ b/uast/diff/testdata/45_src.uast @@ -0,0 +1,307 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 667, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/46_dst.uast b/uast/diff/testdata/46_dst.uast new file mode 100644 index 00000000..90977209 --- /dev/null +++ b/uast/diff/testdata/46_dst.uast @@ -0,0 +1,339 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 784, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/46_src.uast b/uast/diff/testdata/46_src.uast new file mode 100644 index 00000000..20511785 --- /dev/null +++ b/uast/diff/testdata/46_src.uast @@ -0,0 +1,315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/47_dst.uast b/uast/diff/testdata/47_dst.uast new file mode 100644 index 00000000..68a328b4 --- /dev/null +++ b/uast/diff/testdata/47_dst.uast @@ -0,0 +1,497 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 354, + line: 17, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 385, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "not used currently", + }, + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 21, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 410, + line: 22, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 22, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 22, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 23, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 453, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 23, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 23, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 23, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 23, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 510, + line: 24, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/47_src.uast b/uast/diff/testdata/47_src.uast new file mode 100644 index 00000000..2d1e7128 --- /dev/null +++ b/uast/diff/testdata/47_src.uast @@ -0,0 +1,1719 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "with_statement", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "__future__", + }, + Target: ~, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 264, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 263, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 277, + line: 15, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 379, + line: 19, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 19, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 21, + col: 32, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "MyFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 22, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 457, + line: 22, + col: 22, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 22, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 22, + col: 29, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 22, + col: 28, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 22, + col: 23, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 23, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 506, + line: 23, + col: 35, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "init_jinja_globals", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 24, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 24, + col: 21, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 31, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 17, + }, + }, + Name: "globals", + }, + ], + }, + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 24, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 53, + }, + }, + Format: "", + Value: "42", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 507, + line: 23, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 511, + line: 23, + col: 40, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "With", + '@token': "with", + '@role': [Block, Scope, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 13, + }, + }, + body: { '@type': "With.body", + '@role': [Block, Body, Incomplete, Scope], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 27, + col: 16, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 624, + line: 27, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 26, + }, + }, + Name: "MyFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 28, + col: 13, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 30, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 30, + col: 23, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 30, + col: 51, + }, + }, + Format: "", + Value: "foo", + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 719, + line: 30, + col: 27, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 30, + col: 37, + }, + }, + Name: "jinja_env", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 30, + col: 24, + }, + }, + Name: "globals", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 758, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 32, + col: 14, + }, + }, + Name: "c", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 763, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 32, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 32, + col: 20, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 32, + col: 17, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 816, + line: 33, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 819, + line: 33, + col: 40, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 33, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 33, + col: 32, + }, + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 33, + col: 31, + }, + }, + Name: "data", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 33, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 831, + line: 33, + col: 52, + }, + }, + Format: "", + Value: "42", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 33, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 33, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 33, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 34, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 870, + line: 34, + col: 38, + }, + }, + Name: "log", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 863, + line: 34, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 34, + col: 34, + }, + }, + Name: "len", + }, + keywords: [], + }, + { '@type': "Num", + '@token': 1, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 873, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 34, + col: 42, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 34, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 850, + line: 34, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 849, + line: 34, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 34, + col: 13, + }, + }, + Name: "assert_equal", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + args: [ + { '@type': "Compare", + '@role': [Argument, Binary, Call, Condition, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 35, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 945, + line: 35, + col: 70, + }, + }, + Format: "", + Value: "message", + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 0, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 35, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 934, + line: 35, + col: 59, + }, + }, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 35, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 35, + col: 57, + }, + }, + Name: "log", + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 35, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 35, + col: 53, + }, + }, + Name: "str", + }, + keywords: [], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 901, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 921, + line: 35, + col: 46, + }, + }, + Format: "", + Value: "init_jinja_globals", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 35, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 893, + line: 35, + col: 18, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 17, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 35, + col: 13, + }, + }, + Name: "assert_", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + items: { '@type': "With.items", + '@role': [Block, Incomplete, Scope], + items: [ + { '@type': "withitem", + '@role': [Expression, Identifier, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + 'context_expr': { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 581, + line: 26, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 595, + line: 26, + col: 28, + }, + }, + Name: "catch_warnings", + }, + keywords: [], + }, + 'optional_vars': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 26, + col: 37, + }, + }, + Name: "log", + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 21, + col: 37, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 960, + line: 38, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 39, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 39, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 977, + line: 39, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 39, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 984, + line: 39, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 39, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1034, + line: 40, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 1054, + line: 40, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1016, + line: 40, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 40, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1023, + line: 40, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 40, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1002, + line: 40, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 1007, + line: 40, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 40, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 40, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1061, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1067, + line: 41, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1068, + line: 41, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1073, + line: 41, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/48_dst.uast b/uast/diff/testdata/48_dst.uast new file mode 100644 index 00000000..84fadeb4 --- /dev/null +++ b/uast/diff/testdata/48_dst.uast @@ -0,0 +1,497 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 354, + line: 17, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 385, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "not used currently", + }, + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 21, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 410, + line: 22, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 22, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 22, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 23, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 453, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 23, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 23, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 23, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 23, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 510, + line: 24, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/48_src.uast b/uast/diff/testdata/48_src.uast new file mode 100644 index 00000000..68a328b4 --- /dev/null +++ b/uast/diff/testdata/48_src.uast @@ -0,0 +1,497 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.deprecations\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskTestCase", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "catch_warnings", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "DeprecationsTestCase", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 340, + line: 17, + col: 27, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 354, + line: 17, + col: 41, + }, + }, + Name: "FlaskTestCase", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 385, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "not used currently", + }, + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 21, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 410, + line: 22, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 414, + line: 22, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 22, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 22, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 22, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 23, + col: 58, + }, + }, + Name: "DeprecationsTestCase", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 453, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 23, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 27, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 19, + }, + }, + Name: "makeSuite", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 23, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 23, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 23, + col: 10, + }, + }, + Name: "suite", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 23, + col: 5, + }, + }, + Name: "addTest", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 24, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 510, + line: 24, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/49_dst.uast b/uast/diff/testdata/49_dst.uast new file mode 100644 index 00000000..90977209 --- /dev/null +++ b/uast/diff/testdata/49_dst.uast @@ -0,0 +1,339 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 784, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/49_src.uast b/uast/diff/testdata/49_src.uast new file mode 100644 index 00000000..20511785 --- /dev/null +++ b/uast/diff/testdata/49_src.uast @@ -0,0 +1,315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/4_dst.uast b/uast/diff/testdata/4_dst.uast new file mode 100644 index 00000000..99e9c673 --- /dev/null +++ b/uast/diff/testdata/4_dst.uast @@ -0,0 +1,317 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "TryExcept", + '@role': [Catch, Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 4, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 4, + col: 13, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 5, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 91, + line: 4, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 103, + line: 4, + col: 42, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 4, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 126, + line: 4, + col: 65, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + kwargs: ~, + starargs: ~, + }, + }, + ], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 128, + line: 5, + col: 1, + }, + }, + '@token': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 146, + line: 5, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 147, + line: 5, + col: 20, + }, + }, + Name: "e", + }, + body: [ + { '@type': "Print", + '@token': "print", + '@role': [Call, Callee, Expression, Function, Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 153, + line: 6, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 158, + line: 6, + col: 10, + }, + }, + dest: ~, + nl: true, + values: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 159, + line: 6, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 170, + line: 6, + col: 22, + }, + }, + Format: "", + Value: "Error: %s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 6, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 6, + col: 26, + }, + }, + Name: "e", + }, + }, + ], + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 135, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 5, + col: 17, + }, + }, + Name: "Exception", + }, + }, + ], + orelse: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/4_src.uast b/uast/diff/testdata/4_src.uast new file mode 100644 index 00000000..5e167c2e --- /dev/null +++ b/uast/diff/testdata/4_src.uast @@ -0,0 +1,187 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 16, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "BetterLoader", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 58, + line: 3, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 66, + line: 3, + col: 10, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 65, + line: 3, + col: 9, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 1, + }, + }, + Name: "main", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "testLoader", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 82, + line: 3, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 94, + line: 3, + col: 38, + }, + }, + Name: "BetterLoader", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "defaultTest", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 3, + col: 54, + }, + end: { '@type': "uast:Position", + offset: 117, + line: 3, + col: 61, + }, + }, + Format: "", + Value: "suite", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/50_dst.uast b/uast/diff/testdata/50_dst.uast new file mode 100644 index 00000000..bff36d11 --- /dev/null +++ b/uast/diff/testdata/50_dst.uast @@ -0,0 +1,355 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/50_src.uast b/uast/diff/testdata/50_src.uast new file mode 100644 index 00000000..90977209 --- /dev/null +++ b/uast/diff/testdata/50_src.uast @@ -0,0 +1,339 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 784, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/51_dst.uast b/uast/diff/testdata/51_dst.uast new file mode 100644 index 00000000..28866856 --- /dev/null +++ b/uast/diff/testdata/51_dst.uast @@ -0,0 +1,363 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 739, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/51_src.uast b/uast/diff/testdata/51_src.uast new file mode 100644 index 00000000..bff36d11 --- /dev/null +++ b/uast/diff/testdata/51_src.uast @@ -0,0 +1,355 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/52_dst.uast b/uast/diff/testdata/52_dst.uast new file mode 100644 index 00000000..09c48468 --- /dev/null +++ b/uast/diff/testdata/52_dst.uast @@ -0,0 +1,421 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 28, + col: 5, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 889, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/52_src.uast b/uast/diff/testdata/52_src.uast new file mode 100644 index 00000000..28866856 --- /dev/null +++ b/uast/diff/testdata/52_src.uast @@ -0,0 +1,363 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 739, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/53_dst.uast b/uast/diff/testdata/53_dst.uast new file mode 100644 index 00000000..f89f5921 --- /dev/null +++ b/uast/diff/testdata/53_dst.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/53_src.uast b/uast/diff/testdata/53_src.uast new file mode 100644 index 00000000..39658041 --- /dev/null +++ b/uast/diff/testdata/53_src.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 620, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 29, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 29, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 29, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 28, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 28, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/54_dst.uast b/uast/diff/testdata/54_dst.uast new file mode 100644 index 00000000..da853933 --- /dev/null +++ b/uast/diff/testdata/54_dst.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/54_src.uast b/uast/diff/testdata/54_src.uast new file mode 100644 index 00000000..f89f5921 --- /dev/null +++ b/uast/diff/testdata/54_src.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/55_dst.uast b/uast/diff/testdata/55_dst.uast new file mode 100644 index 00000000..789f7077 --- /dev/null +++ b/uast/diff/testdata/55_dst.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 619, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 28, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 28, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 651, + line: 28, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 27, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 628, + line: 27, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/55_src.uast b/uast/diff/testdata/55_src.uast new file mode 100644 index 00000000..da853933 --- /dev/null +++ b/uast/diff/testdata/55_src.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/56_dst.uast b/uast/diff/testdata/56_dst.uast new file mode 100644 index 00000000..a7eae88a --- /dev/null +++ b/uast/diff/testdata/56_dst.uast @@ -0,0 +1,843 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 15, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 15, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 269, + line: 15, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 286, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 16, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 17, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 17, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 19, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 21, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 21, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 21, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 21, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 21, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 21, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 463, + line: 21, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 462, + line: 21, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 21, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 21, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 22, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 22, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 510, + line: 22, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 515, + line: 22, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 516, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 523, + line: 22, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 510, + line: 22, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 22, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 548, + line: 23, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 23, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 575, + line: 25, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 578, + line: 25, + col: 24, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 25, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 9, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 632, + line: 25, + col: 78, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 26, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 643, + line: 26, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 650, + line: 26, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 649, + line: 26, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 16, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 16, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 16, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 308, + line: 16, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 40, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 45, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 16, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 45, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 16, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 53, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 324, + line: 16, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 53, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/56_src.uast b/uast/diff/testdata/56_src.uast new file mode 100644 index 00000000..0e24d942 --- /dev/null +++ b/uast/diff/testdata/56_src.uast @@ -0,0 +1,1430 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 220, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n tests.deprecations\n ~~~~~~~~~~~~~~~~~~\n\n Tests deprecation support. Not used currently.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 225, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "pytest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 224, + line: 11, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 239, + line: 13, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "ClassDef", + '@token': "TestRequestDeprecation", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 17, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 283, + line: 17, + col: 29, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 284, + line: 17, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 290, + line: 17, + col: 36, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 318, + line: 18, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_json", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 19, + col: 41, + }, + }, + Format: "", + Value: "Request.json is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 465, + line: 23, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 23, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Dict", + '@role': [Expression, Literal, Map, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 23, + col: 42, + }, + }, + keys: [ + { '@type': "uast:String", + '@role': [Key, Map], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 23, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 501, + line: 23, + col: 49, + }, + }, + Format: "", + Value: "spam", + }, + ], + values: [ + { '@type': "Num", + '@token': 42, + '@role': [Expression, Literal, Map, Number, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 23, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 505, + line: 23, + col: 53, + }, + }, + }, + ], + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 23, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 23, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 23, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 23, + col: 20, + }, + }, + Name: "json", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 24, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 24, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 531, + line: 24, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 24, + col: 32, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 19, + }, + }, + Name: "json", + }, + ], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 24, + col: 18, + }, + }, + Name: "print", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 557, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 25, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 590, + line: 27, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 593, + line: 27, + col: 24, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 27, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 27, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 578, + line: 27, + col: 9, + }, + }, + Name: "post", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "data", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 45, + }, + }, + Format: "", + Value: "{\"spam\": 42}", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "content_type", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 27, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 78, + }, + }, + Format: "", + Value: "application/json", + }, + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 28, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 687, + line: 28, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 658, + line: 28, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 664, + line: 28, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 657, + line: 28, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 323, + line: 18, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 40, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 18, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 45, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 339, + line: 18, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 18, + col: 53, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 30, + col: 28, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_request_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 789, + line: 31, + col: 43, + }, + }, + Format: "", + Value: "Request.module is deprecated", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 799, + line: 33, + col: 9, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 35, + col: 19, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 879, + line: 35, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 48, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 35, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 860, + line: 35, + col: 25, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 35, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 868, + line: 35, + col: 33, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 35, + col: 20, + }, + }, + Name: "module", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 36, + col: 19, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 903, + line: 36, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 36, + col: 24, + }, + }, + Format: "", + Value: "OK", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 38, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 931, + line: 38, + col: 23, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 38, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 924, + line: 38, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 923, + line: 38, + col: 15, + }, + }, + Name: "client", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 38, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 39, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 971, + line: 39, + col: 39, + }, + }, + Name: "DeprecationWarning", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 942, + line: 39, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 949, + line: 39, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 948, + line: 39, + col: 16, + }, + }, + Name: "recwarn", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 941, + line: 39, + col: 9, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 30, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 722, + line: 30, + col: 33, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 724, + line: 30, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 30, + col: 42, + }, + }, + Name: "recwarn", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 30, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 30, + col: 47, + }, + }, + Name: "app", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 30, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 30, + col: 55, + }, + }, + Name: "client", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/57_dst.uast b/uast/diff/testdata/57_dst.uast new file mode 100644 index 00000000..22c066a0 --- /dev/null +++ b/uast/diff/testdata/57_dst.uast @@ -0,0 +1,306 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 191, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 194, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n Flaskr Tests\n ~~~~~~~~~~~~\n\n Tests the Flaskr application.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 211, + line: 12, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "find_packages", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 14, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 15, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 15, + col: 18, + }, + }, + Format: "", + Value: "flaskr", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "packages", + }, + value: { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 280, + line: 16, + col: 14, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 280, + line: 16, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 293, + line: 16, + col: 27, + }, + }, + Name: "find_packages", + }, + keywords: [], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "include_package_data", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 322, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 326, + line: 17, + col: 30, + }, + }, + value: true, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 18, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 366, + line: 19, + col: 16, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "setup_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 394, + line: 21, + col: 20, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 404, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 419, + line: 22, + col: 24, + }, + }, + Format: "", + Value: "pytest-runner", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "tests_require", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 24, + col: 19, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 464, + line: 25, + col: 17, + }, + }, + Format: "", + Value: "pytest", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/57_src.uast b/uast/diff/testdata/57_src.uast new file mode 100644 index 00000000..2de71353 --- /dev/null +++ b/uast/diff/testdata/57_src.uast @@ -0,0 +1,273 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 1, + col: 16, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "setuptools", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 3, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 4, + col: 18, + }, + }, + Format: "", + Value: "flaskr", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "packages", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 69, + line: 5, + col: 14, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 78, + line: 5, + col: 23, + }, + }, + Format: "", + Value: "flaskr", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "include_package_data", + }, + value: { '@type': "BoolLiteral", + '@token': "True", + '@role': [Argument, Boolean, Expression, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 30, + }, + }, + value: true, + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "install_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 7, + col: 22, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 8, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 150, + line: 8, + col: 16, + }, + }, + Format: "", + Value: "flask", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "setup_requires", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 178, + line: 10, + col: 20, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 188, + line: 11, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 203, + line: 11, + col: 24, + }, + }, + Format: "", + Value: "pytest-runner", + }, + ], + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "tests_require", + }, + value: { '@type': "List", + '@role': [Argument, Expression, List, Literal, Primitive, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 19, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 14, + col: 17, + }, + }, + Format: "", + Value: "pytest", + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/58_dst.uast b/uast/diff/testdata/58_dst.uast new file mode 100644 index 00000000..7e8b9dab --- /dev/null +++ b/uast/diff/testdata/58_dst.uast @@ -0,0 +1,997 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 294, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 489, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 576, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 637, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 695, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 686, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 724, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/58_src.uast b/uast/diff/testdata/58_src.uast new file mode 100644 index 00000000..5f515f47 --- /dev/null +++ b/uast/diff/testdata/58_src.uast @@ -0,0 +1,682 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 264, + line: 13, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 313, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 331, + line: 16, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 334, + line: 16, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 347, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 358, + line: 17, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 17, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 17, + col: 32, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 17, + col: 52, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 17, + col: 56, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 34, + }, + }, + Name: "app", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 361, + line: 17, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 371, + line: 17, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 415, + line: 18, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 18, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 459, + line: 18, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 18, + col: 30, + }, + }, + Name: "request", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 428, + line: 18, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 19, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 28, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 19, + col: 48, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 19, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 520, + line: 19, + col: 52, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 30, + }, + }, + Name: "session", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 19, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 531, + line: 20, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Lambda", + '@role': [Anonymous, Argument, Call, Declaration, Function, Name, Positional, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 20, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 551, + line: 20, + col: 22, + }, + }, + args: { '@type': "arguments", + '@role': [Argument, Declaration, Function, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + args: [], + }, + body: { '@type': "FunctionDef.body", + '@role': [Body, Declaration, Function], + 'body_stmts': { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 20, + col: 42, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 20, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 575, + line: 20, + col: 46, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 20, + col: 24, + }, + }, + Name: "g", + }, + ], + }, + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 534, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 20, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/59_dst.uast b/uast/diff/testdata/59_dst.uast new file mode 100644 index 00000000..aa8a8d65 --- /dev/null +++ b/uast/diff/testdata/59_dst.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 612, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/59_src.uast b/uast/diff/testdata/59_src.uast new file mode 100644 index 00000000..7e8b9dab --- /dev/null +++ b/uast/diff/testdata/59_src.uast @@ -0,0 +1,997 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 294, + line: 14, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 344, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 381, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 380, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 489, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 481, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 345, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 349, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 518, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 539, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 552, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 585, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 599, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 577, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 576, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 609, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 663, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 630, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 637, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 695, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 720, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 686, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 723, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 724, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 760, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 762, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 765, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 737, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/5_dst.uast b/uast/diff/testdata/5_dst.uast new file mode 100644 index 00000000..4c15dc9b --- /dev/null +++ b/uast/diff/testdata/5_dst.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/5_src.uast b/uast/diff/testdata/5_src.uast new file mode 100644 index 00000000..ba157e75 --- /dev/null +++ b/uast/diff/testdata/5_src.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 2, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/60_dst.uast b/uast/diff/testdata/60_dst.uast new file mode 100644 index 00000000..4d9f3719 --- /dev/null +++ b/uast/diff/testdata/60_dst.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 612, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/60_src.uast b/uast/diff/testdata/60_src.uast new file mode 100644 index 00000000..aa8a8d65 --- /dev/null +++ b/uast/diff/testdata/60_src.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 612, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/61_dst.uast b/uast/diff/testdata/61_dst.uast new file mode 100644 index 00000000..20208574 --- /dev/null +++ b/uast/diff/testdata/61_dst.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 24, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 25, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 25, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 613, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 25, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 26, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 661, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 716, + line: 27, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 27, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 27, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 28, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 28, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 28, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 28, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/61_src.uast b/uast/diff/testdata/61_src.uast new file mode 100644 index 00000000..4d9f3719 --- /dev/null +++ b/uast/diff/testdata/61_src.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 612, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/62_dst.uast b/uast/diff/testdata/62_dst.uast new file mode 100644 index 00000000..789f7077 --- /dev/null +++ b/uast/diff/testdata/62_dst.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 619, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 28, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 28, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 651, + line: 28, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 28, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 27, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 628, + line: 27, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/62_src.uast b/uast/diff/testdata/62_src.uast new file mode 100644 index 00000000..da853933 --- /dev/null +++ b/uast/diff/testdata/62_src.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/63_dst.uast b/uast/diff/testdata/63_dst.uast new file mode 100644 index 00000000..09c48468 --- /dev/null +++ b/uast/diff/testdata/63_dst.uast @@ -0,0 +1,421 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 28, + col: 5, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 889, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/63_src.uast b/uast/diff/testdata/63_src.uast new file mode 100644 index 00000000..28866856 --- /dev/null +++ b/uast/diff/testdata/63_src.uast @@ -0,0 +1,363 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 739, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/64_dst.uast b/uast/diff/testdata/64_dst.uast new file mode 100644 index 00000000..b4b1531b --- /dev/null +++ b/uast/diff/testdata/64_dst.uast @@ -0,0 +1,456 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 639, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 23, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 24, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 878, + line: 28, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/64_src.uast b/uast/diff/testdata/64_src.uast new file mode 100644 index 00000000..09c48468 --- /dev/null +++ b/uast/diff/testdata/64_src.uast @@ -0,0 +1,421 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 20, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 22, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 23, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 765, + line: 24, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 28, + col: 5, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 889, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/65_dst.uast b/uast/diff/testdata/65_dst.uast new file mode 100644 index 00000000..9145c39e --- /dev/null +++ b/uast/diff/testdata/65_dst.uast @@ -0,0 +1,464 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 783, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/65_src.uast b/uast/diff/testdata/65_src.uast new file mode 100644 index 00000000..b4b1531b --- /dev/null +++ b/uast/diff/testdata/65_src.uast @@ -0,0 +1,456 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 639, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 23, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 24, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 878, + line: 28, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/66_dst.uast b/uast/diff/testdata/66_dst.uast new file mode 100644 index 00000000..20208574 --- /dev/null +++ b/uast/diff/testdata/66_dst.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 24, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 25, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 25, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 613, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 25, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 26, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 661, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 716, + line: 27, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 27, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 27, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 28, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 28, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 28, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 28, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/66_src.uast b/uast/diff/testdata/66_src.uast new file mode 100644 index 00000000..4d9f3719 --- /dev/null +++ b/uast/diff/testdata/66_src.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 23, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 23, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 555, + line: 23, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 569, + line: 24, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 24, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 24, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 24, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 612, + line: 24, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 583, + line: 24, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 24, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 24, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 24, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 622, + line: 25, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 644, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 25, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 25, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 669, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 25, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 625, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 25, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 26, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 701, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 693, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 729, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 27, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 752, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 766, + line: 27, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 27, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 27, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 744, + line: 27, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 27, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 743, + line: 27, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/67_dst.uast b/uast/diff/testdata/67_dst.uast new file mode 100644 index 00000000..f910c3f9 --- /dev/null +++ b/uast/diff/testdata/67_dst.uast @@ -0,0 +1,1315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 23, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 532, + line: 24, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 24, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 560, + line: 25, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 26, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 26, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 27, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 27, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 31, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 712, + line: 31, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 32, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 33, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 33, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 33, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 34, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 34, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 34, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 34, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 34, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 845, + line: 35, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 35, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 35, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 35, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 35, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 36, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 36, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 36, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/67_src.uast b/uast/diff/testdata/67_src.uast new file mode 100644 index 00000000..20208574 --- /dev/null +++ b/uast/diff/testdata/67_src.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 24, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 25, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 25, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 613, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 25, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 26, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 661, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 716, + line: 27, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 27, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 27, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 28, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 28, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 28, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 28, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/68_dst.uast b/uast/diff/testdata/68_dst.uast new file mode 100644 index 00000000..0bae8e2f --- /dev/null +++ b/uast/diff/testdata/68_dst.uast @@ -0,0 +1,350 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 22, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 23, + col: 19, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "ExtensionImporter", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../../exthook", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 24, + col: 13, + }, + }, + Name: "importer", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 24, + col: 34, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 24, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 24, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 24, + col: 60, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 24, + col: 63, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 24, + col: 71, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 24, + col: 33, + }, + }, + Name: "ExtensionImporter", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 25, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 25, + col: 13, + }, + }, + Name: "importer", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + Name: "install", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 28, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 29, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 29, + col: 10, + }, + }, + Name: "setup", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/68_src.uast b/uast/diff/testdata/68_src.uast new file mode 100644 index 00000000..ad237dd4 --- /dev/null +++ b/uast/diff/testdata/68_src.uast @@ -0,0 +1,350 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 22, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 23, + col: 19, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "ExtensionImporter", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../../exthook", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 24, + col: 13, + }, + }, + Name: "importer", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 24, + col: 34, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 24, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 24, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 24, + col: 60, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 24, + col: 63, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 24, + col: 71, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 24, + col: 33, + }, + }, + Name: "ExtensionImporter", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 25, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 25, + col: 13, + }, + }, + Name: "importer", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + Name: "install", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 28, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 29, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 29, + col: 10, + }, + }, + Name: "setup", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/69_dst.uast b/uast/diff/testdata/69_dst.uast new file mode 100644 index 00000000..39658041 --- /dev/null +++ b/uast/diff/testdata/69_dst.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 620, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 29, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 29, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 29, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 28, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 28, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/69_src.uast b/uast/diff/testdata/69_src.uast new file mode 100644 index 00000000..28acd733 --- /dev/null +++ b/uast/diff/testdata/69_src.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 620, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 29, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 29, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 29, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 28, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 28, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/6_dst.uast b/uast/diff/testdata/6_dst.uast new file mode 100644 index 00000000..8275baeb --- /dev/null +++ b/uast/diff/testdata/6_dst.uast @@ -0,0 +1,398 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "sys", + }, + Node: {}, + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 20, + line: 1, + col: 21, + }, + }, + lines: [ + { '@type': "uast:Comment", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + Block: false, + Prefix: "!/", + Suffix: "\n", + Tab: "", + Text: "usr/bin/env python", + }, + ], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + args: [ + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 53, + line: 3, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 3, + col: 18, + }, + }, + }, + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 88, + line: 3, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 3, + col: 60, + }, + }, + Name: "__file__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 3, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 75, + line: 3, + col: 39, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 74, + line: 3, + col: 38, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 75, + line: 3, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 3, + col: 43, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 72, + line: 3, + col: 36, + }, + }, + Name: "dirname", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 3, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 58, + line: 3, + col: 22, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 3, + col: 27, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 3, + col: 20, + }, + }, + Name: "abspath", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 38, + line: 3, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 41, + line: 3, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 40, + line: 3, + col: 4, + }, + }, + Name: "sys", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 41, + line: 3, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 45, + line: 3, + col: 9, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 37, + line: 3, + col: 1, + }, + }, + Name: "insert", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 4, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 137, + line: 5, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/6_src.uast b/uast/diff/testdata/6_src.uast new file mode 100644 index 00000000..4c15dc9b --- /dev/null +++ b/uast/diff/testdata/6_src.uast @@ -0,0 +1,69 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 22, + line: 2, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "main", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 59, + line: 3, + col: 5, + }, + }, + Name: "main", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/70_dst.uast b/uast/diff/testdata/70_dst.uast new file mode 100644 index 00000000..f89f5921 --- /dev/null +++ b/uast/diff/testdata/70_dst.uast @@ -0,0 +1,720 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/70_src.uast b/uast/diff/testdata/70_src.uast new file mode 100644 index 00000000..39658041 --- /dev/null +++ b/uast/diff/testdata/70_src.uast @@ -0,0 +1,869 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 229, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n jQuery Example\n ~~~~~~~~~~~~~~\n\n A simple application that shows how Flask and jQuery get along.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 233, + line: 11, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 11, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 292, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 12, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 312, + line: 12, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 303, + line: 12, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 316, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "add_numbers", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 17, + col: 62, + }, + }, + Format: "", + Value: "Add two numbers server side, ridiculous but well...", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 429, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 430, + line: 18, + col: 6, + }, + }, + Name: "a", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 450, + line: 18, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 453, + line: 18, + col: 29, + }, + }, + Format: "", + Value: "a", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 18, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 18, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 18, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 445, + line: 18, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 433, + line: 18, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 18, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 466, + line: 18, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 19, + col: 6, + }, + }, + Name: "b", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 19, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 19, + col: 29, + }, + }, + Format: "", + Value: "b", + }, + { '@type': "Num", + '@token': 0, + '@role': [Argument, Call, Expression, Function, Literal, Name, Number, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 498, + line: 19, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 19, + col: 32, + }, + }, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 477, + line: 19, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 483, + line: 19, + col: 16, + }, + }, + Name: "request", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 21, + }, + }, + Name: "args", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 476, + line: 19, + col: 9, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "type", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 19, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 19, + col: 42, + }, + }, + Name: "int", + }, + }, + ], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 20, + col: 19, + }, + }, + Name: "jsonify", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "result", + }, + value: { '@type': "BinOp", + '@role': [Argument, Binary, Expression, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 20, + col: 28, + }, + }, + Name: "a", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 541, + line: 20, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 542, + line: 20, + col: 32, + }, + }, + Name: "b", + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 585, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 602, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 25, + col: 40, + }, + }, + Format: "", + Value: "index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 618, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 620, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 650, + line: 29, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 29, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 29, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 649, + line: 29, + col: 5, + }, + }, + Name: "run", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 643, + line: 28, + col: 26, + }, + }, + Format: "", + Value: "__main__", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 621, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 629, + line: 28, + col: 12, + }, + }, + Name: "__name__", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/71_dst.uast b/uast/diff/testdata/71_dst.uast new file mode 100644 index 00000000..2fefa33d --- /dev/null +++ b/uast/diff/testdata/71_dst.uast @@ -0,0 +1,350 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 22, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 23, + col: 19, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "ExtensionImporter", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../../exthook", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 24, + col: 13, + }, + }, + Name: "importer", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 24, + col: 34, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 24, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 24, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 24, + col: 60, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 24, + col: 63, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 24, + col: 71, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 24, + col: 33, + }, + }, + Name: "ExtensionImporter", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 25, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 25, + col: 13, + }, + }, + Name: "importer", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + Name: "install", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 28, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 29, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 29, + col: 10, + }, + }, + Name: "setup", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/71_src.uast b/uast/diff/testdata/71_src.uast new file mode 100644 index 00000000..0bae8e2f --- /dev/null +++ b/uast/diff/testdata/71_src.uast @@ -0,0 +1,350 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 22, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 23, + col: 19, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "ExtensionImporter", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../../exthook", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 24, + col: 13, + }, + }, + Name: "importer", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 24, + col: 34, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 24, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 24, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 24, + col: 60, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 24, + col: 63, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 24, + col: 71, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 24, + col: 33, + }, + }, + Name: "ExtensionImporter", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 25, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 25, + col: 13, + }, + }, + Name: "importer", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + Name: "install", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 28, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 29, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 29, + col: 10, + }, + }, + Name: "setup", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/72_dst.uast b/uast/diff/testdata/72_dst.uast new file mode 100644 index 00000000..9145c39e --- /dev/null +++ b/uast/diff/testdata/72_dst.uast @@ -0,0 +1,464 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 783, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/72_src.uast b/uast/diff/testdata/72_src.uast new file mode 100644 index 00000000..b4b1531b --- /dev/null +++ b/uast/diff/testdata/72_src.uast @@ -0,0 +1,456 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 639, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 652, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 23, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 24, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 842, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 844, + line: 27, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 865, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 878, + line: 28, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 27, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 27, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/73_dst.uast b/uast/diff/testdata/73_dst.uast new file mode 100644 index 00000000..7772ebc3 --- /dev/null +++ b/uast/diff/testdata/73_dst.uast @@ -0,0 +1,472 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 884, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/73_src.uast b/uast/diff/testdata/73_src.uast new file mode 100644 index 00000000..9145c39e --- /dev/null +++ b/uast/diff/testdata/73_src.uast @@ -0,0 +1,464 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 740, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 783, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 869, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 892, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 872, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/74_dst.uast b/uast/diff/testdata/74_dst.uast new file mode 100644 index 00000000..82d91a6d --- /dev/null +++ b/uast/diff/testdata/74_dst.uast @@ -0,0 +1,533 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1022, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 32, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 33, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1025, + line: 32, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1039, + line: 32, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/74_src.uast b/uast/diff/testdata/74_src.uast new file mode 100644 index 00000000..7772ebc3 --- /dev/null +++ b/uast/diff/testdata/74_src.uast @@ -0,0 +1,472 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 884, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/75_dst.uast b/uast/diff/testdata/75_dst.uast new file mode 100644 index 00000000..ad237dd4 --- /dev/null +++ b/uast/diff/testdata/75_dst.uast @@ -0,0 +1,350 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 22, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 687, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 23, + col: 19, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "ExtensionImporter", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../../exthook", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 739, + line: 24, + col: 13, + }, + }, + Name: "importer", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + }, + args: [ + { '@type': "List", + '@role': [Argument, Call, Expression, Function, List, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 760, + line: 24, + col: 34, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 761, + line: 24, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 771, + line: 24, + col: 45, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 24, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 786, + line: 24, + col: 60, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 789, + line: 24, + col: 63, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 24, + col: 71, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 24, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 759, + line: 24, + col: 33, + }, + }, + Name: "ExtensionImporter", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 25, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 811, + line: 25, + col: 13, + }, + }, + Name: "importer", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 5, + }, + }, + Name: "install", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 829, + line: 28, + col: 6, + }, + }, + Name: "setup", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 29, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 841, + line: 29, + col: 10, + }, + }, + Name: "setup", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/75_src.uast b/uast/diff/testdata/75_src.uast new file mode 100644 index 00000000..c188349a --- /dev/null +++ b/uast/diff/testdata/75_src.uast @@ -0,0 +1,3684 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 664, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 19, + col: 4, + }, + }, + Format: "", + Value: "\n flask.ext\n ~~~~~~~~~\n\n Redirect imports for extensions. This module basically makes it possible\n for us to transition from flaskext.foo to flask_foo without having to\n force all extensions to upgrade at the same time.\n\n When a user does ``from flask.ext.foo import bar`` it will attempt to\n import ``from flask_foo import bar`` first and when that fails it will\n try to import ``from flaskext.foo import bar``.\n\n We're switching from namespace packages because it was just too painful for\n everybody involved.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "ClassDef", + '@token': "_ExtensionImporter", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 676, + line: 22, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 22, + col: 25, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 695, + line: 22, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 22, + col: 32, + }, + }, + Name: "object", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 914, + line: 26, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 708, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 921, + line: 26, + col: 8, + }, + }, + Format: "", + Value: "This importer redirects imports from this submodule to other locations.\n This makes it possible to transition from the old flaskext.name to the\n newer flask_name without people having a hard time.\n ", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 926, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 27, + col: 20, + }, + }, + Name: "_module_choices", + }, + ], + value: { '@type': "List", + '@role': [Expression, List, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 27, + col: 23, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 27, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 27, + col: 34, + }, + }, + Format: "", + Value: "flask_%s", + }, + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 957, + line: 27, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 970, + line: 27, + col: 49, + }, + }, + Format: "", + Value: "flaskext.%s", + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 981, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 989, + line: 29, + col: 17, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "__init__", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1005, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1013, + line: 30, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "meta_path", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "sys", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1039, + line: 31, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1040, + line: 31, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1044, + line: 31, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1039, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1043, + line: 31, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1039, + line: 31, + col: 9, + }, + }, + Name: "prefix", + }, + ], + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 31, + col: 23, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1053, + line: 31, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1061, + line: 31, + col: 31, + }, + }, + Name: "__name__", + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1043, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1044, + line: 31, + col: 14, + }, + }, + Format: "", + Value: ".", + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 32, + col: 9, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1077, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 1081, + line: 32, + col: 14, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 32, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1080, + line: 32, + col: 13, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 32, + col: 9, + }, + }, + Name: "prefix_cutoff", + }, + ], + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1097, + line: 32, + col: 30, + }, + }, + left: { '@type': "Call", + '@role': [Binary, Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1097, + line: 32, + col: 30, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1080, + line: 32, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1081, + line: 32, + col: 14, + }, + }, + Format: "", + Value: ".", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1098, + line: 32, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1106, + line: 32, + col: 39, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1097, + line: 32, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 32, + col: 38, + }, + }, + Name: "__name__", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1097, + line: 32, + col: 30, + }, + }, + Name: "count", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1119, + line: 32, + col: 52, + }, + end: { '@type': "uast:Position", + offset: 1120, + line: 32, + col: 53, + }, + }, + }, + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1486, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1491, + line: 39, + col: 18, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_name", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1508, + line: 40, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1508, + line: 40, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1511, + line: 40, + col: 16, + }, + }, + Name: "cls", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1514, + line: 40, + col: 19, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1519, + line: 40, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1520, + line: 40, + col: 25, + }, + }, + Name: "x", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1514, + line: 40, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1518, + line: 40, + col: 23, + }, + }, + Name: "type", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1534, + line: 41, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1540, + line: 41, + col: 19, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1562, + line: 41, + col: 41, + }, + }, + left: { '@type': "BinOp", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1541, + line: 41, + col: 20, + }, + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1542, + line: 41, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1545, + line: 41, + col: 24, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1541, + line: 41, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1544, + line: 41, + col: 23, + }, + }, + Name: "cls", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1541, + line: 41, + col: 20, + }, + }, + Name: "__module__", + }, + ], + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:String", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1544, + line: 41, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 1545, + line: 41, + col: 24, + }, + }, + Format: "", + Value: ".", + }, + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "QualifiedIdentifier", + '@role': [Binary, Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1565, + line: 41, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1568, + line: 41, + col: 47, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1564, + line: 41, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 1567, + line: 41, + col: 46, + }, + }, + Name: "cls", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1564, + line: 41, + col: 43, + }, + }, + Name: "__name__", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1492, + line: 39, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1493, + line: 39, + col: 20, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1492, + line: 39, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1493, + line: 39, + col: 20, + }, + }, + Name: "x", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1585, + line: 42, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1585, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1589, + line: 42, + col: 13, + }, + }, + Name: "this", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1592, + line: 42, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1598, + line: 42, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1602, + line: 42, + col: 26, + }, + }, + Name: "self", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1592, + line: 42, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1597, + line: 42, + col: 21, + }, + }, + Name: "_name", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1612, + line: 43, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1612, + line: 43, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Slice", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + lower: ~, + step: ~, + upper: ~, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1612, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1621, + line: 43, + col: 18, + }, + }, + Name: "meta_path", + }, + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1627, + line: 43, + col: 24, + }, + }, + left: { '@type': "ListComp", + '@role': [Binary, Expression, For, Left, List], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1628, + line: 43, + col: 25, + }, + }, + elt: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1628, + line: 43, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 1629, + line: 43, + col: 26, + }, + }, + Name: "x", + }, + generators: [ + { '@type': "comprehension", + '@role': [Expression, For, Incomplete, Iterator], + '@pos': { '@type': "uast:Positions", + }, + ifs: [ + { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1652, + line: 43, + col: 49, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1664, + line: 43, + col: 61, + }, + end: { '@type': "uast:Position", + offset: 1668, + line: 43, + col: 65, + }, + }, + Name: "this", + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1652, + line: 43, + col: 49, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1658, + line: 43, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 1659, + line: 43, + col: 56, + }, + }, + Name: "x", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1652, + line: 43, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 1657, + line: 43, + col: 54, + }, + }, + Name: "_name", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "NotEq", + '@token': "!=", + '@role': [Equal, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + ], + iter: { '@type': "uast:Identifier", + '@role': [For, Statement, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1639, + line: 43, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 1648, + line: 43, + col: 45, + }, + }, + Name: "meta_path", + }, + target: { '@type': "uast:Identifier", + '@role': [Expression, For], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1634, + line: 43, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1635, + line: 43, + col: 32, + }, + }, + Name: "x", + }, + }, + ], + }, + op: { '@type': "Add", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "List", + '@role': [Binary, Expression, List, Literal, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1672, + line: 43, + col: 69, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1673, + line: 43, + col: 70, + }, + end: { '@type': "uast:Position", + offset: 1677, + line: 43, + col: 74, + }, + }, + Name: "self", + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 29, + col: 22, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 990, + line: 29, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 29, + col: 22, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1688, + line: 45, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1699, + line: 45, + col: 20, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "find_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1736, + line: 46, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1738, + line: 46, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1785, + line: 47, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1791, + line: 47, + col: 19, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1792, + line: 47, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1796, + line: 47, + col: 24, + }, + }, + Name: "self", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1739, + line: 46, + col: 12, + }, + }, + args: [ + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1760, + line: 46, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1764, + line: 46, + col: 37, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1759, + line: 46, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 1763, + line: 46, + col: 36, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1759, + line: 46, + col: 32, + }, + }, + Name: "prefix", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1740, + line: 46, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1748, + line: 46, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1739, + line: 46, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1747, + line: 46, + col: 20, + }, + }, + Name: "fullname", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1739, + line: 46, + col: 12, + }, + }, + Name: "startswith", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1700, + line: 45, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1704, + line: 45, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1700, + line: 45, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1704, + line: 45, + col: 25, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1706, + line: 45, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1714, + line: 45, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1706, + line: 45, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1714, + line: 45, + col: 35, + }, + }, + Name: "fullname", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1716, + line: 45, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1720, + line: 45, + col: 41, + }, + }, + Init: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1721, + line: 45, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 1725, + line: 45, + col: 46, + }, + }, + Name: "None", + }, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1716, + line: 45, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 1720, + line: 45, + col: 41, + }, + }, + Name: "path", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1806, + line: 49, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1817, + line: 49, + col: 20, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "load_module", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1843, + line: 50, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1851, + line: 50, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "modules", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "exc_info", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "sys", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1885, + line: 51, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1887, + line: 51, + col: 11, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1921, + line: 52, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 1927, + line: 52, + col: 19, + }, + }, + value: { '@type': "Subscript", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1928, + line: 52, + col: 20, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1936, + line: 52, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 1944, + line: 52, + col: 36, + }, + }, + Name: "fullname", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1928, + line: 52, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1935, + line: 52, + col: 27, + }, + }, + Name: "modules", + }, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1888, + line: 51, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1900, + line: 51, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1907, + line: 51, + col: 31, + }, + }, + Name: "modules", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1888, + line: 51, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 1896, + line: 51, + col: 20, + }, + }, + Name: "fullname", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1954, + line: 53, + col: 9, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1954, + line: 53, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1961, + line: 53, + col: 16, + }, + }, + Name: "modname", + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1964, + line: 53, + col: 19, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2005, + line: 53, + col: 60, + }, + end: { '@type': "uast:Position", + offset: 2009, + line: 53, + col: 64, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2004, + line: 53, + col: 59, + }, + end: { '@type': "uast:Position", + offset: 2008, + line: 53, + col: 63, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2004, + line: 53, + col: 59, + }, + }, + Name: "prefix_cutoff", + }, + ], + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1964, + line: 53, + col: 19, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1972, + line: 53, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1973, + line: 53, + col: 28, + }, + }, + Format: "", + Value: ".", + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1985, + line: 53, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 1989, + line: 53, + col: 44, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1984, + line: 53, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 1988, + line: 53, + col: 43, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1984, + line: 53, + col: 39, + }, + }, + Name: "prefix_cutoff", + }, + ], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1965, + line: 53, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 1973, + line: 53, + col: 28, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1964, + line: 53, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1972, + line: 53, + col: 27, + }, + }, + Name: "fullname", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1964, + line: 53, + col: 19, + }, + }, + Name: "split", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + }, + { '@type': "For", + '@token': "for", + '@role': [For, Iterator, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2032, + line: 54, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 2035, + line: 54, + col: 12, + }, + }, + body: { '@type': "For.body", + '@role': [Body, For, Then], + 'body_stmts': [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2078, + line: 55, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2078, + line: 55, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 2086, + line: 55, + col: 21, + }, + }, + Name: "realname", + }, + ], + value: { '@type': "BinOp", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2089, + line: 55, + col: 24, + }, + }, + left: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2089, + line: 55, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 2093, + line: 55, + col: 28, + }, + }, + Name: "path", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2096, + line: 55, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 2103, + line: 55, + col: 38, + }, + }, + Name: "modname", + }, + }, + }, + { '@type': "TryExcept", + '@role': [Catch, Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2116, + line: 56, + col: 13, + }, + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2137, + line: 57, + col: 17, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2137, + line: 57, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2148, + line: 57, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 2156, + line: 57, + col: 36, + }, + }, + Name: "realname", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2137, + line: 57, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 2147, + line: 57, + col: 27, + }, + }, + Name: "__import__", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + ], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2170, + line: 58, + col: 13, + }, + }, + '@token': ~, + body: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2206, + line: 59, + col: 17, + }, + }, + targets: [ + { '@type': "Tuple", + '@role': [Expression, Left, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2206, + line: 59, + col: 17, + }, + }, + ctx: "Store", + elts: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2206, + line: 59, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 2214, + line: 59, + col: 25, + }, + }, + Name: "exc_type", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2216, + line: 59, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 2225, + line: 59, + col: 36, + }, + }, + Name: "exc_value", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2227, + line: 59, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 2229, + line: 59, + col: 40, + }, + }, + Name: "tb", + }, + ], + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2232, + line: 59, + col: 43, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2232, + line: 59, + col: 43, + }, + end: { '@type': "uast:Position", + offset: 2240, + line: 59, + col: 51, + }, + }, + Name: "exc_info", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2976, + line: 70, + col: 17, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2976, + line: 70, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2988, + line: 70, + col: 29, + }, + end: { '@type': "uast:Position", + offset: 2996, + line: 70, + col: 37, + }, + }, + Name: "fullname", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2998, + line: 70, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 3002, + line: 70, + col: 43, + }, + }, + Name: "None", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2977, + line: 70, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 2984, + line: 70, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2976, + line: 70, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 2983, + line: 70, + col: 24, + }, + }, + Name: "modules", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2976, + line: 70, + col: 17, + }, + }, + Name: "pop", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3020, + line: 71, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 3022, + line: 71, + col: 19, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3086, + line: 72, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 3091, + line: 72, + col: 26, + }, + }, + inst: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3102, + line: 72, + col: 37, + }, + end: { '@type': "uast:Position", + offset: 3111, + line: 72, + col: 46, + }, + }, + Name: "exc_value", + }, + tback: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3113, + line: 72, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 3115, + line: 72, + col: 50, + }, + }, + Name: "tb", + }, + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3092, + line: 72, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 3100, + line: 72, + col: 35, + }, + }, + Name: "exc_type", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Call", + '@role': [Call, Condition, Expression, Function, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3023, + line: 71, + col: 20, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3051, + line: 71, + col: 48, + }, + end: { '@type': "uast:Position", + offset: 3059, + line: 71, + col: 56, + }, + }, + Name: "realname", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3061, + line: 71, + col: 58, + }, + end: { '@type': "uast:Position", + offset: 3063, + line: 71, + col: 60, + }, + }, + Name: "tb", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3024, + line: 71, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 3028, + line: 71, + col: 25, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3023, + line: 71, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 3027, + line: 71, + col: 24, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3023, + line: 71, + col: 20, + }, + }, + Name: "is_important_traceback", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "Continue", + '@token': "continue", + '@role': [Continue, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3132, + line: 73, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 3140, + line: 73, + col: 25, + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2177, + line: 58, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 2188, + line: 58, + col: 31, + }, + }, + Name: "ImportError", + }, + }, + ], + orelse: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3153, + line: 74, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3153, + line: 74, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 3159, + line: 74, + col: 19, + }, + }, + Name: "module", + }, + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3162, + line: 74, + col: 22, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3170, + line: 74, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 3178, + line: 74, + col: 38, + }, + }, + Name: "fullname", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3162, + line: 74, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 3169, + line: 74, + col: 29, + }, + }, + Name: "modules", + }, + }, + ], + value: { '@type': "Subscript", + '@role': [Expression, Incomplete, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3182, + line: 74, + col: 42, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3190, + line: 74, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 3198, + line: 74, + col: 58, + }, + }, + Name: "realname", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3182, + line: 74, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 3189, + line: 74, + col: 49, + }, + }, + Name: "modules", + }, + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3212, + line: 75, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 3214, + line: 75, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3251, + line: 76, + col: 17, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3251, + line: 76, + col: 17, + }, + }, + args: [ + { '@type': "Subscript", + '@role': [Argument, Call, Expression, Function, Incomplete, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3259, + line: 76, + col: 25, + }, + }, + ctx: "Load", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3267, + line: 76, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 3275, + line: 76, + col: 41, + }, + }, + Name: "__name__", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3259, + line: 76, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 3266, + line: 76, + col: 32, + }, + }, + Name: "modules", + }, + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3278, + line: 76, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 3285, + line: 76, + col: 51, + }, + }, + Name: "modname", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3287, + line: 76, + col: 53, + }, + end: { '@type': "uast:Position", + offset: 3293, + line: 76, + col: 59, + }, + }, + Name: "module", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3251, + line: 76, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 3258, + line: 76, + col: 24, + }, + }, + Name: "setattr", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3215, + line: 75, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3226, + line: 75, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 3233, + line: 75, + col: 34, + }, + }, + Name: "modname", + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3215, + line: 75, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 3218, + line: 75, + col: 19, + }, + }, + Format: "", + Value: ".", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "NotIn", + '@token': "not in", + '@role': [Contains, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3307, + line: 77, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 3313, + line: 77, + col: 19, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3314, + line: 77, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 3320, + line: 77, + col: 26, + }, + }, + Name: "module", + }, + }, + ], + }, + iter: { '@type': "QualifiedIdentifier", + '@role': [Expression, For, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2045, + line: 54, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 2049, + line: 54, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2044, + line: 54, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 2048, + line: 54, + col: 25, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2044, + line: 54, + col: 21, + }, + }, + Name: "_module_choices", + }, + ], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, For], + 'else_stmts': [], + }, + target: { '@type': "uast:Identifier", + '@role': [For, Update], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 2036, + line: 54, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 2040, + line: 54, + col: 17, + }, + }, + Name: "path", + }, + }, + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3329, + line: 78, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 3334, + line: 78, + col: 14, + }, + }, + inst: ~, + tback: ~, + type: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3335, + line: 78, + col: 15, + }, + }, + args: [ + { '@type': "BinOp", + '@role': [Argument, Binary, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3347, + line: 78, + col: 27, + }, + }, + left: { '@type': "uast:String", + '@role': [Binary, Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3347, + line: 78, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 3367, + line: 78, + col: 47, + }, + }, + Format: "", + Value: "No module named %s", + }, + op: { '@type': "Mod", + '@token': "%", + '@role': [Arithmetic, Binary, Module, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "uast:Identifier", + '@role': [Binary, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3370, + line: 78, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 3378, + line: 78, + col: 58, + }, + }, + Name: "fullname", + }, + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3335, + line: 78, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 3346, + line: 78, + col: 26, + }, + }, + Name: "ImportError", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1818, + line: 49, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1822, + line: 49, + col: 25, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1818, + line: 49, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 1822, + line: 49, + col: 25, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1824, + line: 49, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1832, + line: 49, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1824, + line: 49, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 1832, + line: 49, + col: 35, + }, + }, + Name: "fullname", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3389, + line: 80, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 3411, + line: 80, + col: 31, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "is_important_traceback", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3753, + line: 86, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3449, + line: 81, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 3764, + line: 86, + col: 12, + }, + }, + Format: "", + Value: "Walks a traceback's frames and checks if any of the frames\n originated in the given important module. If that is the case\n then we were able to import the module itself but apparently\n something went wrong when the module was imported. (Eg: import\n of an import failed).\n ", + }, + }, + { '@type': "While", + '@token': "while", + '@role': [Statement, While], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4681, + line: 101, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4686, + line: 101, + col: 14, + }, + }, + body: { '@type': "For.body", + '@role': [Body, Then, While], + 'body_stmts': [ + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4715, + line: 102, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4717, + line: 102, + col: 15, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4793, + line: 103, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 4799, + line: 103, + col: 23, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4800, + line: 103, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 4804, + line: 103, + col: 28, + }, + }, + Name: "True", + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4718, + line: 102, + col: 16, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4759, + line: 102, + col: 57, + }, + end: { '@type': "uast:Position", + offset: 4775, + line: 102, + col: 73, + }, + }, + Name: "important_module", + }, + ], + }, + left: { '@type': "Call", + '@role': [Call, Expression, Function, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4718, + line: 102, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4744, + line: 102, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 4754, + line: 102, + col: 52, + }, + }, + Format: "", + Value: "__name__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4719, + line: 102, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 4721, + line: 102, + col: 19, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4718, + line: 102, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 4720, + line: 102, + col: 18, + }, + }, + Name: "tb", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4721, + line: 102, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 4729, + line: 102, + col: 27, + }, + }, + Name: "tb_frame", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4730, + line: 102, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 4739, + line: 102, + col: 37, + }, + }, + Name: "f_globals", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4718, + line: 102, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4817, + line: 104, + col: 13, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4817, + line: 104, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 4819, + line: 104, + col: 15, + }, + }, + Name: "tb", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4823, + line: 104, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 4825, + line: 104, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4822, + line: 104, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 4824, + line: 104, + col: 20, + }, + }, + Name: "tb", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4822, + line: 104, + col: 18, + }, + }, + Name: "tb_next", + }, + ], + }, + }, + ], + }, + orelse: { '@type': "For.orelse", + '@token': "else", + '@role': [Body, Else, While], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, While], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4687, + line: 101, + col: 15, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4697, + line: 101, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 4701, + line: 101, + col: 29, + }, + }, + Name: "None", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4687, + line: 101, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 4689, + line: 101, + col: 17, + }, + }, + Name: "tb", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "IsNot", + '@token': "is not", + '@role': [Identical, Not, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4841, + line: 105, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 4847, + line: 105, + col: 15, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4848, + line: 105, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 4853, + line: 105, + col: 21, + }, + }, + Name: "False", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3412, + line: 80, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 3416, + line: 80, + col: 36, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3412, + line: 80, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 3416, + line: 80, + col: 36, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3418, + line: 80, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 3434, + line: 80, + col: 54, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3418, + line: 80, + col: 38, + }, + end: { '@type': "uast:Position", + offset: 3434, + line: 80, + col: 54, + }, + }, + Name: "important_module", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3436, + line: 80, + col: 56, + }, + end: { '@type': "uast:Position", + offset: 3438, + line: 80, + col: 58, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 3436, + line: 80, + col: 56, + }, + end: { '@type': "uast:Position", + offset: 3438, + line: 80, + col: 58, + }, + }, + Name: "tb", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4856, + line: 108, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4856, + line: 108, + col: 1, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4856, + line: 108, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 4874, + line: 108, + col: 19, + }, + }, + Name: "_ExtensionImporter", + }, + keywords: [], + kwargs: ~, + starargs: ~, + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4877, + line: 109, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 4880, + line: 109, + col: 4, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4881, + line: 109, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 4899, + line: 109, + col: 23, + }, + }, + Name: "_ExtensionImporter", + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/76_dst.uast b/uast/diff/testdata/76_dst.uast new file mode 100644 index 00000000..84ef5cb3 --- /dev/null +++ b/uast/diff/testdata/76_dst.uast @@ -0,0 +1,1130 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 183, + line: 12, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 13, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 212, + line: 13, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 217, + line: 13, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 14, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 17, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 17, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 313, + line: 19, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 20, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 341, + line: 20, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 344, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 377, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 421, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 33, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 35, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 35, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 35, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/76_src.uast b/uast/diff/testdata/76_src.uast new file mode 100644 index 00000000..fb3fd575 --- /dev/null +++ b/uast/diff/testdata/76_src.uast @@ -0,0 +1,897 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 12, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 187, + line: 12, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 14, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 15, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 15, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 13, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 13, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 18, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 289, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 20, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 20, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 25, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 415, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/77_dst.uast b/uast/diff/testdata/77_dst.uast new file mode 100644 index 00000000..a95fa1cf --- /dev/null +++ b/uast/diff/testdata/77_dst.uast @@ -0,0 +1,1088 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 242, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 245, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.session\n ~~~~~~~~~~~~~\n\n Implements cookie based sessions based on Werkzeug's secure cookie\n system.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 16, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 16, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 318, + line: 16, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 16, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 19, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 454, + line: 21, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 21, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 484, + line: 22, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 490, + line: 22, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 22, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 512, + line: 22, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 514, + line: 22, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 22, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 22, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 496, + line: 22, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 22, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 544, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 593, + line: 25, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 598, + line: 25, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 24, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 614, + line: 27, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 27, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 27, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 656, + line: 27, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 27, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 625, + line: 27, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 666, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 682, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 696, + line: 28, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 705, + line: 31, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 31, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 31, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 35, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 902, + line: 35, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 912, + line: 37, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 37, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 950, + line: 38, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 955, + line: 38, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 969, + line: 38, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 956, + line: 38, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 968, + line: 38, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 37, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 922, + line: 37, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 933, + line: 37, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 939, + line: 37, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 925, + line: 37, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 929, + line: 37, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1164, + line: 41, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1175, + line: 41, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 41, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 1189, + line: 41, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1192, + line: 41, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 41, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1200, + line: 41, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 1203, + line: 41, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1206, + line: 41, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 1213, + line: 41, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1226, + line: 42, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1232, + line: 42, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1235, + line: 42, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 1245, + line: 42, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1248, + line: 42, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1253, + line: 42, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1258, + line: 43, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1261, + line: 43, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1262, + line: 43, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1267, + line: 43, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/77_src.uast b/uast/diff/testdata/77_src.uast new file mode 100644 index 00000000..3117b6d5 --- /dev/null +++ b/uast/diff/testdata/77_src.uast @@ -0,0 +1,1062 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookie", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.contrib.securecookie", + }, + Target: ~, + }, + { '@type': "ClassDef", + '@token': "Session", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 4, + col: 14, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 4, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 83, + line: 4, + col: 27, + }, + }, + Name: "SecureCookie", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 190, + line: 7, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 90, + line: 5, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 197, + line: 7, + col: 8, + }, + }, + Format: "", + Value: "Expands the session with support for switching between permanent\n and non-permanent sessions.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 207, + line: 9, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 9, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_get_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 10, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 243, + line: 10, + col: 15, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 10, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 10, + col: 37, + }, + }, + Format: "", + Value: "_permanent", + }, + { '@type': "BoolLiteral", + '@token': "False", + '@role': [Argument, Boolean, Call, Expression, Function, Literal, Name, Positional, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 267, + line: 10, + col: 39, + }, + end: { '@type': "uast:Position", + offset: 272, + line: 10, + col: 44, + }, + }, + value: false, + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 10, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 10, + col: 21, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 10, + col: 20, + }, + }, + Name: "self", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 10, + col: 16, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 9, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 226, + line: 9, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 9, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 226, + line: 9, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 283, + line: 12, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 12, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_set_permanent", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 325, + line: 13, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 13, + col: 26, + }, + }, + Format: "", + Value: "_permanent", + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 320, + line: 13, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 324, + line: 13, + col: 13, + }, + }, + Name: "self", + }, + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 13, + col: 30, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 346, + line: 13, + col: 35, + }, + end: { '@type': "uast:Position", + offset: 351, + line: 13, + col: 40, + }, + }, + Name: "value", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 13, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 345, + line: 13, + col: 34, + }, + }, + Name: "bool", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 12, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 298, + line: 12, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 12, + col: 28, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 12, + col: 35, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 12, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 309, + line: 12, + col: 35, + }, + }, + Name: "value", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 15, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 358, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 15, + col: 14, + }, + }, + Name: "permanent", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 15, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 15, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 393, + line: 15, + col: 40, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 15, + col: 42, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 15, + col: 56, + }, + }, + Name: "_set_permanent", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 15, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 15, + col: 25, + }, + }, + Name: "property", + }, + keywords: [], + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 415, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 16, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 16, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 433, + line: 16, + col: 23, + }, + }, + Name: "_get_permanent", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 435, + line: 16, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 16, + col: 39, + }, + }, + Name: "_set_permanent", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "ClassDef", + '@token': "_NullSession", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 458, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 19, + col: 19, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 19, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 478, + line: 19, + col: 27, + }, + }, + Name: "Session", + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 23, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 655, + line: 23, + col: 8, + }, + }, + Format: "", + Value: "Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n ", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 25, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 25, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_fail", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 703, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 26, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 722, + line: 26, + col: 28, + }, + }, + Format: "", + Value: "the session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 721, + line: 26, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 19, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 675, + line: 25, + col: 19, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 686, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 36, + }, + }, + Init: ~, + MapVariadic: true, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 686, + line: 25, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 25, + col: 36, + }, + }, + Name: "kwargs", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 26, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 25, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 682, + line: 25, + col: 26, + }, + }, + Name: "args", + }, + Receiver: false, + Type: ~, + Variadic: true, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 928, + line: 29, + col: 16, + }, + }, + Name: "__setitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 931, + line: 29, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 942, + line: 29, + col: 30, + }, + }, + Name: "__delitem__", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 945, + line: 29, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 950, + line: 29, + col: 38, + }, + }, + Name: "clear", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 29, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 956, + line: 29, + col: 44, + }, + }, + Name: "pop", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 959, + line: 29, + col: 47, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 29, + col: 54, + }, + }, + Name: "popitem", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 979, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 30, + col: 15, + }, + }, + Name: "update", + }, + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 988, + line: 30, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 998, + line: 30, + col: 28, + }, + }, + Name: "setdefault", + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1001, + line: 30, + col: 31, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 30, + col: 36, + }, + }, + Name: "_fail", + }, + }, + { '@type': "Delete", + '@token': "del", + '@role': [Incomplete, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1011, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1014, + line: 31, + col: 8, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 1020, + line: 31, + col: 14, + }, + }, + Name: "_fail", + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/78_dst.uast b/uast/diff/testdata/78_dst.uast new file mode 100644 index 00000000..d23ded90 --- /dev/null +++ b/uast/diff/testdata/78_dst.uast @@ -0,0 +1,999 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 249, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 366, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 372, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 393, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 407, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 407, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 489, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 26, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 28, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 28, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 567, + line: 28, + col: 31, + }, + }, + Format: "", + Value: "test", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 28, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 560, + line: 28, + col: 24, + }, + }, + Name: "Exception", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 30, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 576, + line: 30, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 30, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 30, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 30, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 30, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "errors_stream", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 30, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 30, + col: 54, + }, + }, + Name: "out", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 31, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 31, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 31, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 639, + line: 31, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 638, + line: 31, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 32, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 32, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 32, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 32, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 32, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 32, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "UnaryOp", + '@role': [Boolean, Expression, Operator, Unary], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 33, + col: 12, + }, + }, + op: { '@type': "Not", + '@token': "not", + '@role': [Boolean, Not, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + operand: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 721, + line: 33, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 724, + line: 33, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 723, + line: 33, + col: 19, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/78_src.uast b/uast/diff/testdata/78_src.uast new file mode 100644 index 00000000..d75a9afc --- /dev/null +++ b/uast/diff/testdata/78_src.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/79_dst.uast b/uast/diff/testdata/79_dst.uast new file mode 100644 index 00000000..82d91a6d --- /dev/null +++ b/uast/diff/testdata/79_dst.uast @@ -0,0 +1,533 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1022, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 32, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 33, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1025, + line: 32, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1039, + line: 32, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/79_src.uast b/uast/diff/testdata/79_src.uast new file mode 100644 index 00000000..7772ebc3 --- /dev/null +++ b/uast/diff/testdata/79_src.uast @@ -0,0 +1,472 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 884, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 886, + line: 28, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 907, + line: 29, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 920, + line: 29, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 28, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 28, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/7_dst.uast b/uast/diff/testdata/7_dst.uast new file mode 100644 index 00000000..be0932b1 --- /dev/null +++ b/uast/diff/testdata/7_dst.uast @@ -0,0 +1,152 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 30, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 29, + }, + }, + Format: "", + Value: "foo", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 39, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "foo", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/7_src.uast b/uast/diff/testdata/7_src.uast new file mode 100644 index 00000000..be0932b1 --- /dev/null +++ b/uast/diff/testdata/7_src.uast @@ -0,0 +1,152 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 30, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 29, + }, + }, + Format: "", + Value: "foo", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 39, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "foo", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/80_dst.uast b/uast/diff/testdata/80_dst.uast new file mode 100644 index 00000000..b47cbf0f --- /dev/null +++ b/uast/diff/testdata/80_dst.uast @@ -0,0 +1,562 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 29, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1051, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1053, + line: 33, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1074, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1087, + line: 34, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 33, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 33, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/80_src.uast b/uast/diff/testdata/80_src.uast new file mode 100644 index 00000000..82d91a6d --- /dev/null +++ b/uast/diff/testdata/80_src.uast @@ -0,0 +1,533 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 861, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 874, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1022, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 32, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1045, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1058, + line: 33, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1025, + line: 32, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1039, + line: 32, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/81_dst.uast b/uast/diff/testdata/81_dst.uast new file mode 100644 index 00000000..5e818efc --- /dev/null +++ b/uast/diff/testdata/81_dst.uast @@ -0,0 +1,591 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 764, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 819, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1090, + line: 34, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1111, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1124, + line: 35, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1091, + line: 34, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 34, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/81_src.uast b/uast/diff/testdata/81_src.uast new file mode 100644 index 00000000..b47cbf0f --- /dev/null +++ b/uast/diff/testdata/81_src.uast @@ -0,0 +1,562 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 24, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 798, + line: 25, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 26, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 890, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 903, + line: 29, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1051, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1053, + line: 33, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1074, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1087, + line: 34, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1054, + line: 33, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1068, + line: 33, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/82_dst.uast b/uast/diff/testdata/82_dst.uast new file mode 100644 index 00000000..da360845 --- /dev/null +++ b/uast/diff/testdata/82_dst.uast @@ -0,0 +1,607 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 894, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 951, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1123, + line: 34, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1124, + line: 34, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 34, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/82_src.uast b/uast/diff/testdata/82_src.uast new file mode 100644 index 00000000..5e818efc --- /dev/null +++ b/uast/diff/testdata/82_src.uast @@ -0,0 +1,591 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 694, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 755, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 764, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 804, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 819, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 927, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 940, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1090, + line: 34, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1111, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1124, + line: 35, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1091, + line: 34, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1105, + line: 34, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/83_dst.uast b/uast/diff/testdata/83_dst.uast new file mode 100644 index 00000000..c98a99db --- /dev/null +++ b/uast/diff/testdata/83_dst.uast @@ -0,0 +1,636 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 27, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 972, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 31, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1155, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1191, + line: 36, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1158, + line: 35, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1172, + line: 35, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/83_src.uast b/uast/diff/testdata/83_src.uast new file mode 100644 index 00000000..da360845 --- /dev/null +++ b/uast/diff/testdata/83_src.uast @@ -0,0 +1,607 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 894, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 951, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1123, + line: 34, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1124, + line: 34, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 34, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/84_dst.uast b/uast/diff/testdata/84_dst.uast new file mode 100644 index 00000000..84ef5cb3 --- /dev/null +++ b/uast/diff/testdata/84_dst.uast @@ -0,0 +1,1130 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 183, + line: 12, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 13, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 212, + line: 13, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 217, + line: 13, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 14, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 17, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 17, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 313, + line: 19, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 20, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 341, + line: 20, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 344, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 377, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 421, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 33, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 35, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 35, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 35, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/84_src.uast b/uast/diff/testdata/84_src.uast new file mode 100644 index 00000000..fb3fd575 --- /dev/null +++ b/uast/diff/testdata/84_src.uast @@ -0,0 +1,897 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 12, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 187, + line: 12, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 14, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 14, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 15, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 15, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 15, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 15, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 13, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 13, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 18, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 289, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 20, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 20, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 25, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 415, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 456, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/85_dst.uast b/uast/diff/testdata/85_dst.uast new file mode 100644 index 00000000..477da42b --- /dev/null +++ b/uast/diff/testdata/85_dst.uast @@ -0,0 +1,1254 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 107, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 115, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 163, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 171, + line: 8, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 162, + line: 8, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 193, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 9, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 10, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 199, + line: 10, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 10, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 201, + line: 10, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 13, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 259, + line: 14, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 14, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 14, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 14, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 15, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 276, + line: 15, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 279, + line: 15, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 278, + line: 15, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 15, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 15, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 20, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 21, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 24, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 26, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 26, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 26, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 29, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 31, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 31, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 31, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 34, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 594, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 36, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 36, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 36, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 36, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/85_src.uast b/uast/diff/testdata/85_src.uast new file mode 100644 index 00000000..84ef5cb3 --- /dev/null +++ b/uast/diff/testdata/85_src.uast @@ -0,0 +1,1130 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 183, + line: 12, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 13, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 212, + line: 13, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 217, + line: 13, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 14, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 17, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 17, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 313, + line: 19, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 20, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 341, + line: 20, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 344, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 377, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 421, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 33, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 35, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 35, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 35, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/86_dst.uast b/uast/diff/testdata/86_dst.uast new file mode 100644 index 00000000..c98a99db --- /dev/null +++ b/uast/diff/testdata/86_dst.uast @@ -0,0 +1,636 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 27, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 972, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 31, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1155, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1191, + line: 36, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1158, + line: 35, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1172, + line: 35, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/86_src.uast b/uast/diff/testdata/86_src.uast new file mode 100644 index 00000000..da360845 --- /dev/null +++ b/uast/diff/testdata/86_src.uast @@ -0,0 +1,607 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 894, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 907, + line: 27, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 938, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 951, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1121, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1123, + line: 34, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1144, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1124, + line: 34, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1138, + line: 34, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/87_dst.uast b/uast/diff/testdata/87_dst.uast new file mode 100644 index 00000000..477da42b --- /dev/null +++ b/uast/diff/testdata/87_dst.uast @@ -0,0 +1,1254 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 107, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 115, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 163, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 171, + line: 8, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 162, + line: 8, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 193, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 9, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 10, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 199, + line: 10, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 10, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 201, + line: 10, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 13, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 259, + line: 14, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 14, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 14, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 14, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 15, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 276, + line: 15, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 279, + line: 15, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 278, + line: 15, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 15, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 15, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 20, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 21, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 24, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 26, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 26, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 26, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 29, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 31, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 31, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 31, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 34, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 594, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 36, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 36, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 36, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 36, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/87_src.uast b/uast/diff/testdata/87_src.uast new file mode 100644 index 00000000..84ef5cb3 --- /dev/null +++ b/uast/diff/testdata/87_src.uast @@ -0,0 +1,1130 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 94, + line: 7, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 7, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 106, + line: 7, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 7, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 7, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 7, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 136, + line: 8, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 139, + line: 8, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 8, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 120, + line: 8, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 119, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 116, + line: 8, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 161, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 9, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 142, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 145, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 144, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 141, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 183, + line: 12, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 196, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 13, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 203, + line: 13, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 212, + line: 13, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 214, + line: 13, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 217, + line: 13, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 184, + line: 12, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 189, + line: 12, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 237, + line: 14, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 14, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 14, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 14, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 221, + line: 14, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 14, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 14, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 254, + line: 14, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 262, + line: 17, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 275, + line: 17, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 310, + line: 19, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 311, + line: 19, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 313, + line: 19, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 309, + line: 19, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 326, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 20, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 341, + line: 20, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 18, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 302, + line: 18, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 344, + line: 23, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 377, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 383, + line: 25, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 25, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 417, + line: 25, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 25, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 421, + line: 28, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 455, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 30, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 30, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 30, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 462, + line: 30, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 477, + line: 30, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 33, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 35, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 35, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 544, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 35, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/88_dst.uast b/uast/diff/testdata/88_dst.uast new file mode 100644 index 00000000..fa52dabf --- /dev/null +++ b/uast/diff/testdata/88_dst.uast @@ -0,0 +1,1262 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 78, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 88, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 108, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 124, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 132, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 160, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 187, + line: 9, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 11, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 12, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 12, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 12, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 289, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 17, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 17, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 17, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod2_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 22, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 22, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 22, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 394, + line: 22, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 25, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod3_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 465, + line: 27, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 482, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 481, + line: 27, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 30, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 30, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 30, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 555, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 31, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 31, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 31, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 31, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 32, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 32, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 32, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 32, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 32, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 602, + line: 35, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 36, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 36, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 36, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 36, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 656, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 37, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 37, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 37, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 37, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 663, + line: 37, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 37, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/88_src.uast b/uast/diff/testdata/88_src.uast new file mode 100644 index 00000000..477da42b --- /dev/null +++ b/uast/diff/testdata/88_src.uast @@ -0,0 +1,1254 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 107, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 115, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 163, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 171, + line: 8, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 162, + line: 8, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 193, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 9, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 10, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 199, + line: 10, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 10, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 201, + line: 10, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 13, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 259, + line: 14, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 14, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 14, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 14, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 15, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 276, + line: 15, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 279, + line: 15, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 278, + line: 15, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 15, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 15, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 20, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 21, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 24, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 26, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 26, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 26, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 29, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 31, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 31, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 31, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 34, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 594, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 36, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 36, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 36, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 36, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/89_dst.uast b/uast/diff/testdata/89_dst.uast new file mode 100644 index 00000000..32b12d6e --- /dev/null +++ b/uast/diff/testdata/89_dst.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 276, + line: 13, + col: 20, + }, + }, + Format: "", + Value: "0.7", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 408, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 432, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 713, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 787, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 836, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 851, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 867, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 885, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 901, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 949, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 962, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 993, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1006, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1176, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1178, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1199, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1212, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1179, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1193, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/89_src.uast b/uast/diff/testdata/89_src.uast new file mode 100644 index 00000000..c98a99db --- /dev/null +++ b/uast/diff/testdata/89_src.uast @@ -0,0 +1,636 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 15, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 411, + line: 16, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 422, + line: 16, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 455, + line: 18, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 488, + line: 19, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 500, + line: 19, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 528, + line: 20, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 692, + line: 23, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 705, + line: 23, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 766, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 24, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 803, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 815, + line: 25, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 846, + line: 26, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 864, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 27, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 928, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 28, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 972, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 985, + line: 31, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1155, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1157, + line: 35, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1178, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1191, + line: 36, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1158, + line: 35, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1172, + line: 35, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/8_dst.uast b/uast/diff/testdata/8_dst.uast new file mode 100644 index 00000000..c64b255e --- /dev/null +++ b/uast/diff/testdata/8_dst.uast @@ -0,0 +1,155 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 27, + line: 2, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 36, + line: 2, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 53, + line: 2, + col: 30, + }, + }, + Format: "", + Value: "yourapplication", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 2, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 56, + line: 4, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "yourapplication.views", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 3, + col: 1, + }, + }, + lines: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/8_src.uast b/uast/diff/testdata/8_src.uast new file mode 100644 index 00000000..a62a1070 --- /dev/null +++ b/uast/diff/testdata/8_src.uast @@ -0,0 +1,154 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 27, + line: 2, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 36, + line: 2, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 44, + line: 2, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 30, + line: 2, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 35, + line: 2, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "yourapplication.views", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 3, + col: 1, + }, + }, + lines: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/90_dst.uast b/uast/diff/testdata/90_dst.uast new file mode 100644 index 00000000..f910c3f9 --- /dev/null +++ b/uast/diff/testdata/90_dst.uast @@ -0,0 +1,1315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 23, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 532, + line: 24, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 24, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 560, + line: 25, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 26, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 26, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 27, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 27, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 31, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 712, + line: 31, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 32, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 33, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 33, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 33, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 34, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 34, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 34, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 34, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 34, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 845, + line: 35, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 35, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 35, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 35, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 35, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 36, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 36, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 36, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/90_src.uast b/uast/diff/testdata/90_src.uast new file mode 100644 index 00000000..20208574 --- /dev/null +++ b/uast/diff/testdata/90_src.uast @@ -0,0 +1,992 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 24, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 543, + line: 24, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 546, + line: 24, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 24, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 559, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 570, + line: 25, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 25, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 25, + col: 48, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 608, + line: 25, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 613, + line: 25, + col: 55, + }, + }, + Format: "", + Value: "app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 25, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 591, + line: 25, + col: 33, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 573, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 26, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 26, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 661, + line: 26, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 670, + line: 26, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 26, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 26, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 626, + line: 26, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 26, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 673, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 680, + line: 27, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 27, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 716, + line: 27, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 718, + line: 27, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 727, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 27, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 701, + line: 27, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 683, + line: 27, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 27, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 730, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 731, + line: 28, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 28, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 767, + line: 28, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 769, + line: 28, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 28, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 28, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 28, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 734, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 744, + line: 28, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/91_dst.uast b/uast/diff/testdata/91_dst.uast new file mode 100644 index 00000000..00bde417 --- /dev/null +++ b/uast/diff/testdata/91_dst.uast @@ -0,0 +1,1681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 17, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_req_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 374, + line: 18, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 392, + line: 18, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 391, + line: 18, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 373, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 402, + line: 19, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 20, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 429, + line: 20, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 443, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 479, + line: 20, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 430, + line: 20, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 20, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 414, + line: 19, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 491, + line: 21, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 21, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 21, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 21, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 21, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 492, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 21, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 356, + line: 17, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 360, + line: 17, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 23, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_app_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 25, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 567, + line: 25, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 553, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 576, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 578, + line: 26, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 600, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 605, + line: 27, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 619, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 27, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 27, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 618, + line: 27, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 586, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 26, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 26, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 665, + line: 28, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 671, + line: 28, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 680, + line: 28, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 683, + line: 28, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 685, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 689, + line: 28, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 672, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 679, + line: 28, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 24, + col: 28, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 706, + line: 31, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 717, + line: 32, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 721, + line: 32, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 735, + line: 32, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 32, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 32, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 743, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 34, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 772, + line: 34, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 786, + line: 34, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 34, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 785, + line: 34, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 753, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 757, + line: 33, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 746, + line: 33, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 832, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 840, + line: 35, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 35, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 35, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 866, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 884, + line: 39, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 887, + line: 39, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 897, + line: 39, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 900, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 914, + line: 40, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 917, + line: 40, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 927, + line: 40, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 930, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 41, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 955, + line: 41, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 964, + line: 41, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 944, + line: 41, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 954, + line: 41, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 966, + line: 42, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 973, + line: 42, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 995, + line: 42, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1013, + line: 42, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1015, + line: 42, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1024, + line: 42, + col: 59, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 987, + line: 42, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 994, + line: 42, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 976, + line: 42, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 986, + line: 42, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1027, + line: 43, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1034, + line: 43, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1056, + line: 43, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 1074, + line: 43, + col: 48, + }, + }, + Name: "_lookup_req_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1076, + line: 43, + col: 50, + }, + end: { '@type': "uast:Position", + offset: 1085, + line: 43, + col: 59, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1048, + line: 43, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 1055, + line: 43, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1037, + line: 43, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 1047, + line: 43, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1088, + line: 44, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1089, + line: 44, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1111, + line: 44, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 1129, + line: 44, + col: 42, + }, + }, + Name: "_lookup_app_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1131, + line: 44, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 1134, + line: 44, + col: 47, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1103, + line: 44, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 1110, + line: 44, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1092, + line: 44, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1102, + line: 44, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/91_src.uast b/uast/diff/testdata/91_src.uast new file mode 100644 index 00000000..f910c3f9 --- /dev/null +++ b/uast/diff/testdata/91_src.uast @@ -0,0 +1,1315 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 246, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 249, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask.globals\n ~~~~~~~~~~~~~\n\n Defines all the global objects that are proxies to the current\n active context.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 251, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 265, + line: 13, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "partial", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "functools", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 14, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalStack", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "LocalProxy", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug.local", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 350, + line: 16, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_lookup_object", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 362, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 365, + line: 17, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 369, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 387, + line: 17, + col: 30, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 386, + line: 17, + col: 29, + }, + }, + Name: "_request_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 17, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 419, + line: 19, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 19, + col: 64, + }, + }, + Format: "", + Value: "working outside of request context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 425, + line: 19, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 405, + line: 18, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 409, + line: 18, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 401, + line: 18, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 20, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 498, + line: 20, + col: 23, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 20, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 504, + line: 20, + col: 29, + }, + }, + Name: "name", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 20, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 494, + line: 20, + col: 19, + }, + }, + Name: "getattr", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 16, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 355, + line: 16, + col: 24, + }, + }, + Name: "name", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 23, + col: 14, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "_find_app", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 529, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 532, + line: 24, + col: 8, + }, + }, + Name: "top", + }, + ], + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 24, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 24, + col: 26, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 25, + }, + }, + Name: "_app_ctx_stack", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 24, + col: 11, + }, + }, + Name: "top", + }, + ], + }, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 558, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 560, + line: 25, + col: 7, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 582, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 587, + line: 26, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 68, + }, + }, + Format: "", + Value: "working outside of application context", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 588, + line: 26, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 26, + col: 27, + }, + }, + Name: "RuntimeError", + }, + keywords: [], + }, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "NoneLiteral", + '@token': "None", + '@role': [Expression, Literal, 'Null', Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 568, + line: 25, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 572, + line: 25, + col: 19, + }, + }, + LiteralValue: "None", + value: ~, + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 25, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 25, + col: 11, + }, + }, + Name: "top", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Is", + '@token': "is", + '@role': [Identical, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 647, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 653, + line: 27, + col: 11, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 655, + line: 27, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 658, + line: 27, + col: 16, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 27, + col: 15, + }, + }, + Name: "top", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 12, + }, + }, + Name: "app", + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 681, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 31, + col: 19, + }, + }, + Name: "_request_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 702, + line: 31, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 712, + line: 31, + col: 32, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 729, + line: 32, + col: 15, + }, + }, + Name: "_app_ctx_stack", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 32, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 742, + line: 32, + col: 28, + }, + }, + Name: "LocalStack", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 745, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 756, + line: 33, + col: 12, + }, + }, + Name: "current_app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 26, + }, + end: { '@type': "uast:Position", + offset: 779, + line: 33, + col: 35, + }, + }, + Name: "_find_app", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 769, + line: 33, + col: 25, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 788, + line: 34, + col: 8, + }, + }, + Name: "request", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 824, + line: 34, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 826, + line: 34, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 835, + line: 34, + col: 55, + }, + }, + Format: "", + Value: "request", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 802, + line: 34, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 809, + line: 34, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 34, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 801, + line: 34, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 845, + line: 35, + col: 8, + }, + }, + Name: "session", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 867, + line: 35, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 881, + line: 35, + col: 44, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 883, + line: 35, + col: 46, + }, + end: { '@type': "uast:Position", + offset: 892, + line: 35, + col: 55, + }, + }, + Format: "", + Value: "session", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 859, + line: 35, + col: 22, + }, + end: { '@type': "uast:Position", + offset: 866, + line: 35, + col: 29, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 35, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 35, + col: 21, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 895, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 896, + line: 36, + col: 2, + }, + }, + Name: "g", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 918, + line: 36, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 932, + line: 36, + col: 38, + }, + }, + Name: "_lookup_object", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 934, + line: 36, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 937, + line: 36, + col: 43, + }, + }, + Format: "", + Value: "g", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 910, + line: 36, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 917, + line: 36, + col: 23, + }, + }, + Name: "partial", + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 899, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 909, + line: 36, + col: 15, + }, + }, + Name: "LocalProxy", + }, + keywords: [], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/92_dst.uast b/uast/diff/testdata/92_dst.uast new file mode 100644 index 00000000..be41e849 --- /dev/null +++ b/uast/diff/testdata/92_dst.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/92_src.uast b/uast/diff/testdata/92_src.uast new file mode 100644 index 00000000..fba81615 --- /dev/null +++ b/uast/diff/testdata/92_src.uast @@ -0,0 +1,1295 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 257, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 258, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 287, + line: 14, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 299, + line: 14, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 322, + line: 16, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 396, + line: 19, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 410, + line: 20, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 425, + line: 20, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 427, + line: 20, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 432, + line: 20, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 431, + line: 20, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 465, + line: 21, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 495, + line: 22, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 499, + line: 22, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 21, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 21, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 472, + line: 21, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 21, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 505, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 508, + line: 24, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 24, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 511, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 519, + line: 24, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 526, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 529, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 532, + line: 25, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 548, + line: 25, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 25, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 532, + line: 25, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 547, + line: 25, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 563, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 566, + line: 26, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 565, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 562, + line: 26, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 26, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 627, + line: 26, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 668, + line: 27, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 671, + line: 27, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 27, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 667, + line: 27, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 27, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 27, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 27, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 642, + line: 27, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 27, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 679, + line: 29, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 31, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 721, + line: 31, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 674, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 674, + line: 28, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 725, + line: 31, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 726, + line: 31, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 33, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 732, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 734, + line: 33, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 759, + line: 33, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 762, + line: 33, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 33, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 738, + line: 33, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 741, + line: 33, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 740, + line: 33, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 33, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 768, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 774, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 793, + line: 34, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 34, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 776, + line: 34, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 778, + line: 34, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 777, + line: 34, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 801, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 807, + line: 35, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 808, + line: 35, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 837, + line: 35, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 839, + line: 35, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 35, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 838, + line: 35, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 836, + line: 35, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 808, + line: 35, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 37, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 37, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 856, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 859, + line: 37, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 874, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 880, + line: 38, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 881, + line: 38, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 888, + line: 38, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 890, + line: 38, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 881, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 884, + line: 38, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/93_dst.uast b/uast/diff/testdata/93_dst.uast new file mode 100644 index 00000000..d75a9afc --- /dev/null +++ b/uast/diff/testdata/93_dst.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/93_src.uast b/uast/diff/testdata/93_src.uast new file mode 100644 index 00000000..be41e849 --- /dev/null +++ b/uast/diff/testdata/93_src.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/94_dst.uast b/uast/diff/testdata/94_dst.uast new file mode 100644 index 00000000..d23ded90 --- /dev/null +++ b/uast/diff/testdata/94_dst.uast @@ -0,0 +1,999 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 249, + line: 13, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + lines: [], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 263, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 304, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 366, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 373, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 372, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 393, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 407, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 407, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 411, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 413, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 421, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 449, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 452, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 460, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 467, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 470, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 489, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 497, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 473, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 488, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 504, + line: 26, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Raise", + '@token': "raise", + '@role': [Statement, Throw], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 28, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 550, + line: 28, + col: 14, + }, + }, + cause: ~, + exc: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 28, + col: 15, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 28, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 567, + line: 28, + col: 31, + }, + }, + Format: "", + Value: "test", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 551, + line: 28, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 560, + line: 28, + col: 24, + }, + }, + Name: "Exception", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 30, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 30, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 576, + line: 30, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 30, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 604, + line: 30, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 30, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 30, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 30, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 30, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 579, + line: 30, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "errors_stream", + }, + value: { '@type': "uast:Identifier", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 620, + line: 30, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 623, + line: 30, + col: 54, + }, + }, + Name: "out", + }, + }, + ], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 629, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 635, + line: 31, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 654, + line: 31, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 657, + line: 31, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 31, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 639, + line: 31, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 638, + line: 31, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 636, + line: 31, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 662, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 668, + line: 32, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 32, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 698, + line: 32, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 32, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 699, + line: 32, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 697, + line: 32, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 669, + line: 32, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 709, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "UnaryOp", + '@role': [Boolean, Expression, Operator, Unary], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 716, + line: 33, + col: 12, + }, + }, + op: { '@type': "Not", + '@token': "not", + '@role': [Boolean, Not, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + operand: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 721, + line: 33, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 724, + line: 33, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 723, + line: 33, + col: 19, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 720, + line: 33, + col: 16, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/94_src.uast b/uast/diff/testdata/94_src.uast new file mode 100644 index 00000000..d75a9afc --- /dev/null +++ b/uast/diff/testdata/94_src.uast @@ -0,0 +1,1266 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 244, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 247, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n tests.subclassing\n ~~~~~~~~~~~~~~~~~\n\n Test that certain behavior of flask can be customized by\n subclasses.\n\n :copyright: (c) 2015 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 248, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flask", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 261, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 273, + line: 13, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StreamHandler", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "logging", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 15, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "StringIO", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask._compat", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 337, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 18, + col: 38, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "test_suppressed_exception_logging", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "ClassDef", + '@token': "SuppressedFlask", + '@role': [Declaration, Identifier, Statement, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 384, + line: 19, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 19, + col: 26, + }, + }, + bases: { '@type': "ClassDef.bases", + '@role': [Base, Declaration, Type], + bases: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 406, + line: 19, + col: 33, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 405, + line: 19, + col: 32, + }, + }, + Name: "flask", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 400, + line: 19, + col: 27, + }, + }, + Name: "Flask", + }, + ], + }, + ], + }, + body: { '@type': "ClassDef.body", + '@role': [Body, Declaration, Type], + 'body_stmts': [ + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 426, + line: 20, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 20, + col: 26, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "log_exception", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 469, + line: 21, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 473, + line: 21, + col: 17, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 20, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 444, + line: 20, + col: 31, + }, + }, + Name: "self", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 446, + line: 20, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 454, + line: 20, + col: 41, + }, + }, + Name: "exc_info", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + ], + }, + 'decorator_list': { '@type': "ClassDef.decorator_list", + '@role': [Call, Declaration, Incomplete, Type], + decorators: [], + }, + keywords: [], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 482, + line: 23, + col: 8, + }, + }, + Name: "out", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 485, + line: 23, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 23, + col: 19, + }, + }, + Name: "StringIO", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 500, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 503, + line: 24, + col: 8, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 522, + line: 24, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 530, + line: 24, + col: 35, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 506, + line: 24, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 521, + line: 24, + col: 26, + }, + }, + Name: "SuppressedFlask", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 537, + line: 25, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 540, + line: 25, + col: 9, + }, + }, + ctx: "Store", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 25, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 25, + col: 5, + }, + }, + Name: "logger_name", + }, + ], + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 554, + line: 25, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 601, + line: 25, + col: 70, + }, + }, + Format: "", + Value: "flask_tests/test_suppressed_exception_logging", + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 642, + line: 26, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 645, + line: 26, + col: 44, + }, + }, + Name: "out", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 628, + line: 26, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 26, + col: 40, + }, + }, + Name: "StreamHandler", + }, + keywords: [], + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 26, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 609, + line: 26, + col: 8, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 610, + line: 26, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 26, + col: 15, + }, + }, + Name: "logger", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 606, + line: 26, + col: 5, + }, + }, + Name: "addHandler", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 653, + line: 28, + col: 5, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + value: { '@type': "BinOp", + '@role': [Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + }, + left: { '@type': "Num", + '@token': 1, + '@role': [Binary, Expression, Left, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 30, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 695, + line: 30, + col: 10, + }, + }, + 'noops_previous': { '@type': "PreviousNoops", + '@role': [Noop], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 648, + line: 27, + col: 1, + }, + }, + lines: [], + }, + }, + op: { '@type': "FloorDiv", + '@token': "//", + '@role': [Arithmetic, Binary, Divide, Incomplete, Operator], + '@pos': { '@type': "uast:Positions", + }, + }, + right: { '@type': "Num", + '@token': 0, + '@role': [Binary, Expression, Literal, Number, Primitive, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 699, + line: 30, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 700, + line: 30, + col: 15, + }, + }, + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 706, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 708, + line: 32, + col: 7, + }, + }, + Name: "rv", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 733, + line: 32, + col: 32, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 32, + col: 35, + }, + }, + Format: "", + Value: "/", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 712, + line: 32, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 715, + line: 32, + col: 14, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 714, + line: 32, + col: 13, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "test_client", + }, + ], + }, + keywords: [], + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 711, + line: 32, + col: 10, + }, + }, + Name: "get", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 742, + line: 33, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 748, + line: 33, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "Num", + '@token': 500, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 33, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 33, + col: 33, + }, + }, + }, + ], + }, + left: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Left, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 750, + line: 33, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 752, + line: 33, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 33, + col: 14, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 749, + line: 33, + col: 12, + }, + }, + Name: "status_code", + }, + ], + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 775, + line: 34, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 781, + line: 34, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 811, + line: 34, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 813, + line: 34, + col: 43, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + end: { '@type': "uast:Position", + offset: 812, + line: 34, + col: 42, + }, + }, + Name: "rv", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 810, + line: 34, + col: 40, + }, + }, + Name: "data", + }, + ], + }, + ], + }, + left: { '@type': "uast:String", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 782, + line: 34, + col: 12, + }, + }, + Format: "", + Value: "Internal Server Error", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "In", + '@token': "in", + '@role': [Contains, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 823, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 826, + line: 36, + col: 8, + }, + }, + Name: "err", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 830, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 36, + col: 15, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + end: { '@type': "uast:Position", + offset: 832, + line: 36, + col: 14, + }, + }, + Name: "out", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 829, + line: 36, + col: 11, + }, + }, + Name: "getvalue", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Assert", + '@token': "assert", + '@role': [Assert, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 848, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 854, + line: 37, + col: 11, + }, + }, + msg: ~, + test: { '@type': "Compare", + '@role': [Binary, Condition, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + }, + comparators: { '@type': "Compare.comparators", + '@role': [Expression, Right], + comparators: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 862, + line: 37, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 864, + line: 37, + col: 21, + }, + }, + Format: "", + Value: "", + }, + ], + }, + left: { '@type': "uast:Identifier", + '@role': [Expression, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 37, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 858, + line: 37, + col: 15, + }, + }, + Name: "err", + }, + ops: { '@type': "Compare.ops", + '@role': [Expression], + ops: [ + { '@type': "Eq", + '@token': "==", + '@role': [Equal, Operator, Relational], + '@pos': { '@type': "uast:Positions", + }, + }, + ], + }, + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/95_dst.uast b/uast/diff/testdata/95_dst.uast new file mode 100644 index 00000000..fa52dabf --- /dev/null +++ b/uast/diff/testdata/95_dst.uast @@ -0,0 +1,1262 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 78, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 88, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 108, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 124, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 132, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 160, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 187, + line: 9, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 11, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 12, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 12, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 12, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 289, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 17, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 17, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 17, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod2_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 22, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 22, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 22, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 394, + line: 22, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 25, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod3_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 465, + line: 27, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 482, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 481, + line: 27, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 30, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 30, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 30, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 555, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 31, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 31, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 31, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 31, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 32, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 32, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 32, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 32, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 32, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 602, + line: 35, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 36, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 36, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 36, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 36, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 656, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 37, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 37, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 37, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 37, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 663, + line: 37, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 37, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/95_src.uast b/uast/diff/testdata/95_src.uast new file mode 100644 index 00000000..477da42b --- /dev/null +++ b/uast/diff/testdata/95_src.uast @@ -0,0 +1,1254 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 34, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 37, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 47, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 46, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 61, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 71, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 79, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 91, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 70, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 93, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 97, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 107, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 115, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 100, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 106, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 122, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 131, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 143, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 151, + line: 8, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 154, + line: 8, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 163, + line: 8, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 171, + line: 8, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 157, + line: 8, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 162, + line: 8, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 193, + line: 9, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 9, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 177, + line: 9, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 176, + line: 9, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 173, + line: 9, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 218, + line: 10, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 10, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 199, + line: 10, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 202, + line: 10, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 201, + line: 10, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 198, + line: 10, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 13, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 240, + line: 13, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 253, + line: 14, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 259, + line: 14, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 260, + line: 14, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 269, + line: 14, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 14, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 274, + line: 14, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 241, + line: 13, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 246, + line: 13, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 294, + line: 15, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 297, + line: 15, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 276, + line: 15, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 279, + line: 15, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 278, + line: 15, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 275, + line: 15, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 301, + line: 15, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 15, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 319, + line: 18, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 332, + line: 18, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 367, + line: 20, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 368, + line: 20, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 370, + line: 20, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 366, + line: 20, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 383, + line: 21, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 21, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 390, + line: 21, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 398, + line: 21, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 351, + line: 19, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 359, + line: 19, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 401, + line: 24, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 434, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 440, + line: 26, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 457, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 474, + line: 26, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 441, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 456, + line: 26, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 29, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 512, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 518, + line: 31, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 556, + line: 31, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 534, + line: 31, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 34, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 594, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 600, + line: 36, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 617, + line: 36, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 644, + line: 36, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 601, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 616, + line: 36, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/96_dst.uast b/uast/diff/testdata/96_dst.uast new file mode 100644 index 00000000..c98d968c --- /dev/null +++ b/uast/diff/testdata/96_dst.uast @@ -0,0 +1,1657 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 60, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 60, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 73, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 81, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 66, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 83, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 90, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 97, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 105, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 107, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 117, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 90, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 119, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 126, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 133, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 141, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 126, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 132, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 157, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 169, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 174, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 183, + line: 9, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 196, + line: 9, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 231, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 232, + line: 11, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 231, + line: 11, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 232, + line: 11, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 234, + line: 11, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 230, + line: 11, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 247, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 12, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 254, + line: 12, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 262, + line: 12, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 215, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 10, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 265, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index_foo", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 302, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 304, + line: 17, + col: 7, + }, + }, + Name: "x1", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 307, + line: 17, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 17, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 17, + col: 33, + }, + }, + Format: "", + Value: "somemod.index", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 307, + line: 17, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 17, + }, + }, + Name: "url_for", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 18, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 336, + line: 18, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 338, + line: 18, + col: 7, + }, + }, + Name: "x2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 18, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 349, + line: 18, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 357, + line: 18, + col: 26, + }, + }, + Format: "", + Value: ".index", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 341, + line: 18, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 348, + line: 18, + col: 17, + }, + }, + Name: "url_for", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 363, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 369, + line: 19, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 19, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 403, + line: 19, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 370, + line: 19, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 385, + line: 19, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 407, + line: 22, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 24, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 440, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 442, + line: 24, + col: 7, + }, + }, + Name: "x1", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 445, + line: 24, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 453, + line: 24, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 468, + line: 24, + col: 33, + }, + }, + Format: "", + Value: "somemod.index", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 445, + line: 24, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 452, + line: 24, + col: 17, + }, + }, + Name: "url_for", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 474, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 476, + line: 25, + col: 7, + }, + }, + Name: "x2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 25, + col: 10, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 487, + line: 25, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 495, + line: 25, + col: 26, + }, + }, + Format: "", + Value: ".index", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 479, + line: 25, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 486, + line: 25, + col: 17, + }, + }, + Name: "url_for", + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 501, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 507, + line: 26, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 26, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 524, + line: 26, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 26, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 508, + line: 26, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 523, + line: 26, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 545, + line: 29, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod2_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 584, + line: 31, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 590, + line: 31, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 31, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 607, + line: 31, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 628, + line: 31, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 591, + line: 31, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 606, + line: 31, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 632, + line: 34, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod3_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 671, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 677, + line: 36, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 36, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 694, + line: 36, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 721, + line: 36, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 678, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 693, + line: 36, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 725, + line: 39, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 725, + line: 39, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 728, + line: 39, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 39, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 737, + line: 39, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 745, + line: 39, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 731, + line: 39, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 736, + line: 39, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 747, + line: 40, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 747, + line: 40, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 40, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 40, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 748, + line: 40, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 751, + line: 40, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 747, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 750, + line: 40, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 747, + line: 40, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 41, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 41, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 792, + line: 41, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 796, + line: 41, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 773, + line: 41, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 776, + line: 41, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 41, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 775, + line: 41, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 772, + line: 41, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 804, + line: 44, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 814, + line: 44, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 827, + line: 45, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 833, + line: 45, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 834, + line: 45, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 834, + line: 45, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 843, + line: 45, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 845, + line: 45, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 848, + line: 45, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 815, + line: 44, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 820, + line: 44, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 815, + line: 44, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 820, + line: 44, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 46, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 46, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 868, + line: 46, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 46, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 850, + line: 46, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 853, + line: 46, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 46, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 852, + line: 46, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 849, + line: 46, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 875, + line: 46, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 885, + line: 46, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/96_src.uast b/uast/diff/testdata/96_src.uast new file mode 100644 index 00000000..fa52dabf --- /dev/null +++ b/uast/diff/testdata/96_src.uast @@ -0,0 +1,1262 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 51, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 54, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 64, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 57, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 63, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 74, + line: 5, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 78, + line: 5, + col: 5, + }, + }, + Name: "mod2", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 88, + line: 5, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 96, + line: 5, + col: 23, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 98, + line: 5, + col: 25, + }, + end: { '@type': "uast:Position", + offset: 108, + line: 5, + col: 35, + }, + }, + Format: "", + Value: "testmod2", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 81, + line: 5, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 87, + line: 5, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 110, + line: 6, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 114, + line: 6, + col: 5, + }, + }, + Name: "mod3", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 124, + line: 6, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 132, + line: 6, + col: 23, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 117, + line: 6, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 123, + line: 6, + col: 14, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "name", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 139, + line: 6, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 148, + line: 6, + col: 39, + }, + }, + Format: "", + Value: "somemod", + }, + }, + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 160, + line: 6, + col: 51, + }, + end: { '@type': "uast:Position", + offset: 165, + line: 6, + col: 56, + }, + }, + Format: "", + Value: "meh", + }, + }, + ], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 174, + line: 9, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 187, + line: 9, + col: 19, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "after_request", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 222, + line: 11, + col: 6, + }, + }, + Name: "g", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 223, + line: 11, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 225, + line: 11, + col: 9, + }, + }, + Name: "db", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 221, + line: 11, + col: 5, + }, + }, + Name: "close", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 238, + line: 12, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 244, + line: 12, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 245, + line: 12, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 253, + line: 12, + col: 20, + }, + }, + Name: "response", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 206, + line: 10, + col: 19, + }, + end: { '@type': "uast:Position", + offset: 214, + line: 10, + col: 27, + }, + }, + Name: "response", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 256, + line: 15, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 289, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 295, + line: 17, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 312, + line: 17, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 17, + col: 45, + }, + }, + Format: "", + Value: "test/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 296, + line: 17, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 17, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 333, + line: 20, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod2_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 372, + line: 22, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 378, + line: 22, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 395, + line: 22, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 416, + line: 22, + col: 49, + }, + }, + Format: "", + Value: "testmod2/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 379, + line: 22, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 394, + line: 22, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 420, + line: 25, + col: 1, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "mod3_index", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 459, + line: 27, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 465, + line: 27, + col: 11, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + }, + args: [ + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 482, + line: 27, + col: 28, + }, + end: { '@type': "uast:Position", + offset: 509, + line: 27, + col: 55, + }, + }, + Format: "", + Value: "something-else/index.html", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 466, + line: 27, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 481, + line: 27, + col: 27, + }, + }, + Name: "render_template", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 516, + line: 30, + col: 4, + }, + }, + Name: "app", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 525, + line: 30, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 533, + line: 30, + col: 21, + }, + }, + Name: "__name__", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 519, + line: 30, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 524, + line: 30, + col: 12, + }, + }, + Name: "Flask", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 555, + line: 31, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 558, + line: 31, + col: 24, + }, + }, + Name: "mod", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 31, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 539, + line: 31, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 538, + line: 31, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 535, + line: 31, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 580, + line: 32, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 584, + line: 32, + col: 25, + }, + }, + Name: "mod2", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 561, + line: 32, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 564, + line: 32, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 563, + line: 32, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 560, + line: 32, + col: 1, + }, + }, + Name: "register_module", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 592, + line: 35, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 602, + line: 35, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "handle_404", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 615, + line: 36, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 621, + line: 36, + col: 11, + }, + }, + value: { '@type': "Tuple", + '@role': [Expression, Literal, Primitive, Tuple], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + }, + ctx: "Load", + elts: [ + { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 622, + line: 36, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 36, + col: 21, + }, + }, + Format: "", + Value: "Testing", + }, + { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 633, + line: 36, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 636, + line: 36, + col: 26, + }, + }, + }, + ], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [ + { '@type': "uast:Argument", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Init: ~, + MapVariadic: false, + Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 603, + line: 35, + col: 16, + }, + end: { '@type': "uast:Position", + offset: 608, + line: 35, + col: 21, + }, + }, + Name: "error", + }, + Receiver: false, + Type: ~, + Variadic: false, + }, + ], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + targets: [ + { '@type': "Subscript", + '@role': [Expression, Incomplete, Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + ctx: "Store", + slice: { '@type': "Index", + '@role': [Expression, Incomplete], + '@pos': { '@type': "uast:Positions", + }, + value: { '@type': "Num", + '@token': 404, + '@role': [Expression, Literal, Number, Primitive], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 656, + line: 37, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 659, + line: 37, + col: 23, + }, + }, + }, + }, + value: { '@type': "QualifiedIdentifier", + '@role': [Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 638, + line: 37, + col: 2, + }, + end: { '@type': "uast:Position", + offset: 641, + line: 37, + col: 5, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 640, + line: 37, + col: 4, + }, + }, + Name: "app", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 637, + line: 37, + col: 1, + }, + }, + Name: "error_handlers", + }, + ], + }, + }, + ], + value: { '@type': "uast:Identifier", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 663, + line: 37, + col: 27, + }, + end: { '@type': "uast:Position", + offset: 673, + line: 37, + col: 37, + }, + }, + Name: "handle_404", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/97_dst.uast b/uast/diff/testdata/97_dst.uast new file mode 100644 index 00000000..b14c76c5 --- /dev/null +++ b/uast/diff/testdata/97_dst.uast @@ -0,0 +1,652 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/97_src.uast b/uast/diff/testdata/97_src.uast new file mode 100644 index 00000000..9a42a9f4 --- /dev/null +++ b/uast/diff/testdata/97_src.uast @@ -0,0 +1,681 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 953, + line: 30, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 966, + line: 30, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Session", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../session", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 997, + line: 33, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1010, + line: 33, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1180, + line: 37, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1182, + line: 37, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1203, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1216, + line: 38, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1183, + line: 37, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1197, + line: 37, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/98_dst.uast b/uast/diff/testdata/98_dst.uast new file mode 100644 index 00000000..824fef1c --- /dev/null +++ b/uast/diff/testdata/98_dst.uast @@ -0,0 +1,683 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1238, + line: 40, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1252, + line: 40, + col: 15, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "SecureCookieSession", + }, + Node: { '@type': "uast:Identifier", + Name: "Session", + }, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../sessions", + }, + Target: ~, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/98_src.uast b/uast/diff/testdata/98_src.uast new file mode 100644 index 00000000..b14c76c5 --- /dev/null +++ b/uast/diff/testdata/98_src.uast @@ -0,0 +1,652 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 252, + line: 11, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 255, + line: 11, + col: 4, + }, + }, + Format: "", + Value: "\n flask\n ~~~~~\n\n A microframework based on Werkzeug. It's extensively documented\n and follows best practice patterns.\n\n :copyright: (c) 2010 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 257, + line: 13, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 268, + line: 13, + col: 12, + }, + }, + Name: "__version__", + }, + ], + value: { '@type': "uast:String", + '@role': [Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 271, + line: 13, + col: 15, + }, + end: { '@type': "uast:Position", + offset: 280, + line: 13, + col: 24, + }, + }, + Format: "", + Value: "0.8-dev", + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 399, + line: 17, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 412, + line: 17, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "abort", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "redirect", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "werkzeug", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 18, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 447, + line: 18, + col: 12, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Markup", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "escape", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "jinja2", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 471, + line: 20, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 480, + line: 20, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Flask", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Response", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../app", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 513, + line: 21, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 525, + line: 21, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Config", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../config", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 540, + line: 22, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 553, + line: 22, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "url_for", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "jsonify", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "flash", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_file", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "send_from_directory", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_flashed_messages", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "get_template_attribute", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "make_response", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "safe_join", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 717, + line: 25, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 730, + line: 25, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "current_app", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "g", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "session", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "_request_ctx_stack", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../globals", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 791, + line: 26, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 800, + line: 26, + col: 10, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "has_request_context", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../ctx", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 828, + line: 27, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 840, + line: 27, + col: 13, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../module", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 855, + line: 28, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 871, + line: 28, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Blueprint", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../blueprints", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 889, + line: 29, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 905, + line: 29, + col: 17, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "render_template_string", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../templating", + }, + Target: ~, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 968, + line: 32, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 981, + line: 32, + col: 14, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "signals_available", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "template_rendered", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_started", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_finished", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "got_request_exception", + }, + Node: {}, + }, + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "request_tearing_down", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../signals", + }, + Target: ~, + }, + { '@type': "If", + '@token': "if", + '@role': [Expression, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1151, + line: 36, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 1153, + line: 36, + col: 3, + }, + }, + body: { '@type': "If.body", + '@role': [Body, If, Then], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1174, + line: 37, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 1187, + line: 37, + col: 18, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "json", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "../helpers", + }, + Target: ~, + }, + ], + }, + orelse: { '@type': "If.orelse", + '@token': "else", + '@role': [Body, Else, If], + 'else_stmts': [], + }, + test: { '@type': "uast:Identifier", + '@role': [Condition, If], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 1154, + line: 36, + col: 4, + }, + end: { '@type': "uast:Position", + offset: 1168, + line: 36, + col: 18, + }, + }, + Name: "json_available", + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/99_dst.uast b/uast/diff/testdata/99_dst.uast new file mode 100644 index 00000000..861b8739 --- /dev/null +++ b/uast/diff/testdata/99_dst.uast @@ -0,0 +1,1128 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.examples\n ~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests the examples.\n\n :copyright: (c) 2014 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 209, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "add_to_path", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 291, + line: 16, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup_path", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 299, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 299, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 17, + col: 17, + }, + }, + Name: "example_path", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 343, + line: 17, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 351, + line: 17, + col: 57, + }, + }, + Name: "__file__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 328, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 17, + col: 36, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 17, + col: 35, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 330, + line: 17, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 334, + line: 17, + col: 40, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + }, + Name: "dirname", + }, + ], + }, + keywords: [], + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 18, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 36, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 35, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 18, + col: 33, + }, + }, + Name: "pardir", + }, + ], + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 400, + line: 18, + col: 47, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 18, + col: 46, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 44, + }, + }, + Name: "pardir", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 65, + }, + }, + Format: "", + Value: "examples", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 17, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 17, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 316, + line: 17, + col: 22, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 17, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 321, + line: 17, + col: 27, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 19, + col: 42, + }, + }, + Name: "example_path", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 19, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 19, + col: 52, + }, + }, + Format: "", + Value: "flaskr", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 19, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 19, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 19, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 19, + col: 24, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 19, + col: 16, + }, + }, + Name: "add_to_path", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 20, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 42, + }, + }, + Name: "example_path", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 20, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 527, + line: 20, + col: 54, + }, + }, + Format: "", + Value: "minitwit", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 20, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 20, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 20, + col: 19, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 497, + line: 20, + col: 24, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 20, + col: 16, + }, + }, + Name: "add_to_path", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 24, + col: 15, + }, + }, + Name: "setup_path", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 575, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 25, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 599, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 602, + line: 26, + col: 8, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 612, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 28, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "MiniTwitTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "minitwit_tests", + }, + Target: ~, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 28, + col: 5, + }, + }, + '@token': ~, + body: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 688, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 29, + col: 13, + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 667, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 678, + line: 28, + col: 23, + }, + }, + Name: "ImportError", + }, + }, + ], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 32, + col: 8, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 26, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskrTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flaskr_tests", + }, + Target: ~, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 34, + col: 5, + }, + }, + '@token': ~, + body: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 852, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 856, + line: 35, + col: 13, + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 831, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 34, + col: 23, + }, + }, + Name: "ImportError", + }, + }, + ], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 935, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/99_src.uast b/uast/diff/testdata/99_src.uast new file mode 100644 index 00000000..9c965bd4 --- /dev/null +++ b/uast/diff/testdata/99_src.uast @@ -0,0 +1,1128 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 205, + line: 10, + col: 1, + }, + }, + value: { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 24, + line: 2, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 208, + line: 10, + col: 4, + }, + }, + Format: "", + Value: "\n flask.testsuite.examples\n ~~~~~~~~~~~~~~~~~~~~~~~~\n\n Tests the examples.\n\n :copyright: (c) 2011 by Armin Ronacher.\n :license: BSD, see LICENSE for more details.\n", + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 209, + line: 11, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "os", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "Import", + '@token': "import", + '@role': [Declaration, Import, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 219, + line: 12, + col: 1, + }, + }, + names: { '@type': "ImportFrom.names", + '@role': [Identifier, Import, Incomplete, Pathname], + 'name_list': [ + { '@type': "uast:RuntimeImport", + All: false, + Names: ~, + Path: { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "unittest", + }, + Node: {}, + }, + Target: ~, + }, + ], + }, + }, + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 235, + line: 13, + col: 1, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "add_to_path", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask.testsuite", + }, + Target: ~, + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 281, + line: 16, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 291, + line: 16, + col: 15, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "setup_path", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 299, + line: 17, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 299, + line: 17, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 311, + line: 17, + col: 17, + }, + }, + Name: "example_path", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 343, + line: 17, + col: 49, + }, + end: { '@type': "uast:Position", + offset: 351, + line: 17, + col: 57, + }, + }, + Name: "__file__", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 328, + line: 17, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 330, + line: 17, + col: 36, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 329, + line: 17, + col: 35, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 330, + line: 17, + col: 36, + }, + end: { '@type': "uast:Position", + offset: 334, + line: 17, + col: 40, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 327, + line: 17, + col: 33, + }, + }, + Name: "dirname", + }, + ], + }, + keywords: [], + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 387, + line: 18, + col: 34, + }, + end: { '@type': "uast:Position", + offset: 389, + line: 18, + col: 36, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 18, + col: 33, + }, + end: { '@type': "uast:Position", + offset: 388, + line: 18, + col: 35, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 386, + line: 18, + col: 33, + }, + }, + Name: "pardir", + }, + ], + }, + { '@type': "QualifiedIdentifier", + '@role': [Argument, Call, Expression, Function, Identifier, Name, Positional, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 398, + line: 18, + col: 45, + }, + end: { '@type': "uast:Position", + offset: 400, + line: 18, + col: 47, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 399, + line: 18, + col: 46, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 397, + line: 18, + col: 44, + }, + }, + Name: "pardir", + }, + ], + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 408, + line: 18, + col: 55, + }, + end: { '@type': "uast:Position", + offset: 418, + line: 18, + col: 65, + }, + }, + Format: "", + Value: "examples", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 315, + line: 17, + col: 21, + }, + end: { '@type': "uast:Position", + offset: 317, + line: 17, + col: 23, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 316, + line: 17, + col: 22, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 317, + line: 17, + col: 23, + }, + end: { '@type': "uast:Position", + offset: 321, + line: 17, + col: 27, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 314, + line: 17, + col: 20, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 449, + line: 19, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 461, + line: 19, + col: 42, + }, + }, + Name: "example_path", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 463, + line: 19, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 471, + line: 19, + col: 52, + }, + }, + Format: "", + Value: "flaskr", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 437, + line: 19, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 439, + line: 19, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 438, + line: 19, + col: 19, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 439, + line: 19, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 443, + line: 19, + col: 24, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 436, + line: 19, + col: 17, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 424, + line: 19, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 435, + line: 19, + col: 16, + }, + }, + Name: "add_to_path", + }, + keywords: [], + }, + }, + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + }, + args: [ + { '@type': "Call", + '@role': [Argument, Call, Expression, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 503, + line: 20, + col: 30, + }, + end: { '@type': "uast:Position", + offset: 515, + line: 20, + col: 42, + }, + }, + Name: "example_path", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 517, + line: 20, + col: 44, + }, + end: { '@type': "uast:Position", + offset: 527, + line: 20, + col: 54, + }, + }, + Format: "", + Value: "minitwit", + }, + ], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 491, + line: 20, + col: 18, + }, + end: { '@type': "uast:Position", + offset: 493, + line: 20, + col: 20, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + end: { '@type': "uast:Position", + offset: 492, + line: 20, + col: 19, + }, + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 493, + line: 20, + col: 20, + }, + end: { '@type': "uast:Position", + offset: 497, + line: 20, + col: 24, + }, + }, + Name: "path", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 490, + line: 20, + col: 17, + }, + }, + Name: "join", + }, + ], + }, + keywords: [], + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 478, + line: 20, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 489, + line: 20, + col: 16, + }, + }, + Name: "add_to_path", + }, + keywords: [], + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + { '@type': "uast:FunctionGroup", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 536, + line: 23, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 541, + line: 23, + col: 10, + }, + }, + Nodes: [ + { + async: false, + }, + { '@type': "uast:Alias", + Name: { '@type': "uast:Identifier", + Name: "suite", + }, + Node: { '@type': "uast:Function", + Body: { '@type': "uast:Block", + Statements: [ + { '@type': "Expr", + '@role': [Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + }, + value: { '@type': "Call", + '@role': [Call, Expression, Function], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + }, + args: [], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 549, + line: 24, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 559, + line: 24, + col: 15, + }, + }, + Name: "setup_path", + }, + keywords: [], + }, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 25, + col: 5, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 566, + line: 25, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 571, + line: 25, + col: 10, + }, + }, + Name: "suite", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + }, + args: [], + func: { '@type': "QualifiedIdentifier", + '@role': [Call, Callee, Expression, Identifier, Qualified], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 575, + line: 25, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 583, + line: 25, + col: 22, + }, + }, + ctx: "Load", + identifiers: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 582, + line: 25, + col: 21, + }, + }, + Name: "unittest", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 574, + line: 25, + col: 13, + }, + }, + Name: "TestSuite", + }, + ], + }, + keywords: [], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 599, + line: 26, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 602, + line: 26, + col: 8, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 612, + line: 27, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 631, + line: 27, + col: 28, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "MiniTwitTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "minitwit_tests", + }, + Target: ~, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 660, + line: 28, + col: 5, + }, + }, + '@token': ~, + body: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 688, + line: 29, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 692, + line: 29, + col: 13, + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 667, + line: 28, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 678, + line: 28, + col: 23, + }, + }, + Name: "ImportError", + }, + }, + ], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + { '@type': "Try", + '@token': "try", + '@role': [Statement, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 767, + line: 32, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 770, + line: 32, + col: 8, + }, + }, + body: { '@type': "Try.body", + '@role': [Body, Try], + 'body_stmts': [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 780, + line: 33, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 797, + line: 33, + col: 26, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "FlaskrTestCase", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flaskr_tests", + }, + Target: ~, + }, + ], + }, + finalbody: { '@type': "Try.finalbody", + '@token': "finally", + '@role': [Finally, Try], + 'final_stmts': [], + }, + handlers: { '@type': "Try.handlers", + '@token': "except", + '@role': [Catch, Try], + handlers: [ + { '@type': "ExceptHandler", + '@role': [Catch, Identifier, Try], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 824, + line: 34, + col: 5, + }, + }, + '@token': ~, + body: [ + { '@type': "Pass", + '@token': "pass", + '@role': [Noop, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 852, + line: 35, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 856, + line: 35, + col: 13, + }, + }, + }, + ], + type: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 831, + line: 34, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 842, + line: 34, + col: 23, + }, + }, + Name: "ImportError", + }, + }, + ], + }, + orelse: { '@type': "Try.else", + '@token': "else", + '@role': [Else, Try], + }, + }, + { '@type': "Return", + '@token': "return", + '@role': [Return, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 929, + line: 38, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 935, + line: 38, + col: 11, + }, + }, + value: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 936, + line: 38, + col: 12, + }, + end: { '@type': "uast:Position", + offset: 941, + line: 38, + col: 17, + }, + }, + Name: "suite", + }, + }, + ], + }, + Type: { '@type': "uast:FunctionType", + Arguments: [], + Returns: ~, + }, + }, + }, + ], + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/9_dst.uast b/uast/diff/testdata/9_dst.uast new file mode 100644 index 00000000..be0932b1 --- /dev/null +++ b/uast/diff/testdata/9_dst.uast @@ -0,0 +1,152 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 30, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 29, + }, + }, + Format: "", + Value: "foo", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 39, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "foo", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/uast/diff/testdata/9_src.uast b/uast/diff/testdata/9_src.uast new file mode 100644 index 00000000..be0932b1 --- /dev/null +++ b/uast/diff/testdata/9_src.uast @@ -0,0 +1,152 @@ +{ '@type': "Module", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + }, + body: [ + { '@type': "uast:RuntimeImport", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 10, + line: 1, + col: 11, + }, + }, + All: false, + Names: [ + { '@type': "uast:Alias", + '@pos': { '@type': "uast:Positions", + }, + Name: { '@type': "uast:Identifier", + Name: "Module", + }, + Node: {}, + }, + ], + Path: { '@type': "uast:Identifier", + Name: "flask", + }, + Target: ~, + }, + { '@type': "Assign", + '@role': [Assignment, Binary, Expression], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + }, + targets: [ + { '@type': "uast:Identifier", + '@role': [Left], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 27, + line: 4, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 30, + line: 4, + col: 4, + }, + }, + Name: "mod", + }, + ], + value: { '@type': "Call", + '@role': [Call, Expression, Function, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + }, + args: [ + { '@type': "uast:Identifier", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 40, + line: 4, + col: 14, + }, + end: { '@type': "uast:Position", + offset: 48, + line: 4, + col: 22, + }, + }, + Name: "__name__", + }, + { '@type': "uast:String", + '@role': [Argument, Call, Function, Name, Positional], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 50, + line: 4, + col: 24, + }, + end: { '@type': "uast:Position", + offset: 55, + line: 4, + col: 29, + }, + }, + Format: "", + Value: "foo", + }, + ], + func: { '@type': "uast:Identifier", + '@role': [Call, Callee], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 33, + line: 4, + col: 7, + }, + end: { '@type': "uast:Position", + offset: 39, + line: 4, + col: 13, + }, + }, + Name: "Module", + }, + keywords: [ + { '@type': "keyword", + '@role': [Argument, Call, Function, Name], + '@pos': { '@type': "uast:Positions", + }, + '@token': { '@type': "uast:Identifier", + Name: "subdomain", + }, + value: { '@type': "uast:String", + '@role': [Argument, Value], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 67, + line: 4, + col: 41, + }, + end: { '@type': "uast:Position", + offset: 72, + line: 4, + col: 46, + }, + }, + Format: "", + Value: "foo", + }, + }, + ], + }, + }, + ], +} \ No newline at end of file