diff --git a/test/example-dataclass-normalization/.meta/config.json b/test/example-dataclass-normalization/.meta/config.json new file mode 100644 index 0000000..755076b --- /dev/null +++ b/test/example-dataclass-normalization/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [ + "brocla" + ], + "files": { + "solution": [ + "example_dataclass_normalization.py" + ] + } +} \ No newline at end of file diff --git a/test/example-dataclass-normalization/example_dataclass_normalization.py b/test/example-dataclass-normalization/example_dataclass_normalization.py new file mode 100644 index 0000000..1f4c0ef --- /dev/null +++ b/test/example-dataclass-normalization/example_dataclass_normalization.py @@ -0,0 +1,96 @@ +""" Dataclasses: + Example code, from three exercises, + that demonstrates the new `slots` and + the `keyword-only` features of dataclasses. + + The slots option is invoked as a parameters to the dataclass decorator. + + Key-words are demonstrated 3 ways: + *** as a parameters to @dataclass, + *** as a parameters to field(), + *** as a sentinel value +""" +from dataclasses import dataclass, field, KW_ONLY + + + +""" +From the `sgf_parsing` exercise +Demonstrates the combined use of slots and kw_only as parameters to @dataclass +""" +@dataclass(frozen=True, slots=True, kw_only=True) # *** *** +class SgfTree: + properties: dict = field(default_factory=dict) + children: list = field(default_factory=list) + +def _parse(input): + properties = input.read_properties() + children = [] + while input.expect(";"): + children.append(SgfTree(properties=input.read_properties())) + while input.expect("(", advance=False): + children.append(_parse(input)) + return SgfTree(properties=properties, children=children) + + + + +""" +From `go_counting` exercise. +Demonstrates the use of slots. + +This exercise also demonstrates uninitialized variables. +See x and y. +""" +@dataclass(unsafe_hash=True, slots=True) +class Point: + x: int + y: int + + def __add__(self, o): + return Point(self.x + o.x, self.y + o.y) + + def __eq__(self, o): + if isinstance(o, Point): + return self.x == o.x and self.y == o.y + return self.x == o[0] and self.y == o[1] + + + +""" +From the `tree_building` exercise. +The Records() class demonstrates slots and kw_only as a field() parameter. +The Node() class demonstrates use of KW_ONLY sentinel. + +Also demonstrates a mix of initialized and uninitialized variables. +See record_id and parent_id. +""" +@dataclass(slots=True) #*** +class Record: + record_id: int + parent_id: int = field(kw_only=True) #*** + + def __lt__(self, other): + return self.record_id < other.record_id + +@dataclass +class Node: + node_id: int + _: KW_ONLY #*** + children: list = field(default_factory=list) + +def BuildTree(records): + records.sort() + + # initialize one node for every record. + trees = [] + for record in records: + trees.append(Node(record.record_id)) + + # match children to parents + for record in records[1:]: + parent = trees[record.parent_id] + child = trees[record.record_id] + parent.children.append(child) + + return trees[0] \ No newline at end of file diff --git a/test/example-dataclass-normalization/mapping.json b/test/example-dataclass-normalization/mapping.json new file mode 100644 index 0000000..e0a3c45 --- /dev/null +++ b/test/example-dataclass-normalization/mapping.json @@ -0,0 +1,19 @@ +{ + "placeholder_0": "SgfTree", + "placeholder_1": "properties", + "placeholder_2": "default_factory", + "placeholder_3": "children", + "placeholder_4": "frozen", + "placeholder_5": "slots", + "placeholder_6": "kw_only", + "placeholder_7": "_parse", + "placeholder_8": "advance", + "placeholder_9": "Node", + "placeholder_10": "node_id", + "placeholder_11": "BuildTree", + "placeholder_12": "records", + "placeholder_13": "trees", + "placeholder_14": "record", + "placeholder_15": "parent", + "placeholder_16": "child" +} \ No newline at end of file diff --git a/test/example-dataclass-normalization/representation.json b/test/example-dataclass-normalization/representation.json new file mode 100644 index 0000000..051b2b6 --- /dev/null +++ b/test/example-dataclass-normalization/representation.json @@ -0,0 +1,3 @@ +{ + "version": 2 +} \ No newline at end of file diff --git a/test/example-dataclass-normalization/representation.out b/test/example-dataclass-normalization/representation.out new file mode 100644 index 0000000..733f9a0 --- /dev/null +++ b/test/example-dataclass-normalization/representation.out @@ -0,0 +1,1894 @@ +## BEGIN NORMALIZED CODE ## +from dataclasses import dataclass, field, KW_ONLY + +"\nFrom the `sgf_parsing` exercise\nDemonstrates the combined use of slots and kw_only as parameters to @dataclass\n" + + +@dataclass(placeholder_4=True, placeholder_5=True, placeholder_6=True) +class placeholder_0: + placeholder_1 = field(placeholder_2=dict) + placeholder_3 = field(placeholder_2=list) + + +def placeholder_7(input): + placeholder_1 = input.read_properties() + placeholder_3 = [] + while input.expect(";"): + placeholder_3.append(placeholder_0(placeholder_1=input.read_properties())) + while input.expect("(", placeholder_8=False): + placeholder_3.append(placeholder_7(input)) + return placeholder_0(placeholder_1=placeholder_1, placeholder_3=placeholder_3) + + +"\nFrom go_counting exercise.\nDemonstrates the use of slots.\n" +"\nFrom the tree_building exercise.\nThe Records() class demonstrates slots. \nThe Node() class demonstrates use of KW_ONLY sentinel.\n" + + +@dataclass +class placeholder_9: + placeholder_10 = 0 + placeholder_3 = field(placeholder_2=list) + + +def placeholder_11(placeholder_12): + placeholder_12.sort() + placeholder_13 = [] + for placeholder_14 in placeholder_12: + placeholder_13.append(placeholder_9(placeholder_14.record_id)) + for placeholder_14 in placeholder_12[1:]: + placeholder_15 = placeholder_13[placeholder_14.parent_id] + placeholder_16 = placeholder_13[placeholder_14.record_id] + placeholder_15.placeholder_3.append(placeholder_16) + return placeholder_13[0] + +## END NORMALIZED CODE ## + +## BEGIN TREE BEFORE ## +Module( + [ + ImportFrom( + 'dataclasses', + [ + alias( + 'dataclass', + lineno=1, + col_offset=24, + end_lineno=1, + end_col_offset=33), + alias( + 'field', + lineno=1, + col_offset=35, + end_lineno=1, + end_col_offset=40), + alias( + 'KW_ONLY', + lineno=1, + col_offset=42, + end_lineno=1, + end_col_offset=49)], + 0, + lineno=1, + col_offset=0, + end_lineno=1, + end_col_offset=49), + Expr( + Constant( + '\nFrom the `sgf_parsing` exercise\nDemonstrates the combined use of slots and kw_only as parameters to @dataclass\n', + lineno=5, + col_offset=0, + end_lineno=8, + end_col_offset=3), + lineno=5, + col_offset=0, + end_lineno=8, + end_col_offset=3), + ClassDef( + 'SgfTree', + [], + [], + [ + AnnAssign( + Name( + 'properties', + Store(), + lineno=11, + col_offset=4, + end_lineno=11, + end_col_offset=14), + Name( + 'dict', + Load(), + lineno=11, + col_offset=16, + end_lineno=11, + end_col_offset=20), + Call( + Name( + 'field', + Load(), + lineno=11, + col_offset=23, + end_lineno=11, + end_col_offset=28), + [], + [ + keyword( + 'default_factory', + Name( + 'dict', + Load(), + lineno=11, + col_offset=45, + end_lineno=11, + end_col_offset=49), + lineno=11, + col_offset=29, + end_lineno=11, + end_col_offset=49)], + lineno=11, + col_offset=23, + end_lineno=11, + end_col_offset=50), + 1, + lineno=11, + col_offset=4, + end_lineno=11, + end_col_offset=50), + AnnAssign( + Name( + 'children', + Store(), + lineno=12, + col_offset=4, + end_lineno=12, + end_col_offset=12), + Name( + 'list', + Load(), + lineno=12, + col_offset=14, + end_lineno=12, + end_col_offset=18), + Call( + Name( + 'field', + Load(), + lineno=12, + col_offset=21, + end_lineno=12, + end_col_offset=26), + [], + [ + keyword( + 'default_factory', + Name( + 'list', + Load(), + lineno=12, + col_offset=43, + end_lineno=12, + end_col_offset=47), + lineno=12, + col_offset=27, + end_lineno=12, + end_col_offset=47)], + lineno=12, + col_offset=21, + end_lineno=12, + end_col_offset=48), + 1, + lineno=12, + col_offset=4, + end_lineno=12, + end_col_offset=48)], + [ + Call( + Name( + 'dataclass', + Load(), + lineno=9, + col_offset=1, + end_lineno=9, + end_col_offset=10), + [], + [ + keyword( + 'frozen', + Constant( + True, + lineno=9, + col_offset=18, + end_lineno=9, + end_col_offset=22), + lineno=9, + col_offset=11, + end_lineno=9, + end_col_offset=22), + keyword( + 'slots', + Constant( + True, + lineno=9, + col_offset=30, + end_lineno=9, + end_col_offset=34), + lineno=9, + col_offset=24, + end_lineno=9, + end_col_offset=34), + keyword( + 'kw_only', + Constant( + True, + lineno=9, + col_offset=44, + end_lineno=9, + end_col_offset=48), + lineno=9, + col_offset=36, + end_lineno=9, + end_col_offset=48)], + lineno=9, + col_offset=1, + end_lineno=9, + end_col_offset=49)], + lineno=10, + col_offset=0, + end_lineno=12, + end_col_offset=48), + FunctionDef( + '_parse', + arguments( + [], + [ + arg( + 'input', + lineno=14, + col_offset=11, + end_lineno=14, + end_col_offset=16)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ + Assign( + [ + Name( + 'properties', + Store(), + lineno=15, + col_offset=4, + end_lineno=15, + end_col_offset=14)], + Call( + Attribute( + Name( + 'input', + Load(), + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=22), + 'read_properties', + Load(), + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=38), + [], + [], + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=40), + lineno=15, + col_offset=4, + end_lineno=15, + end_col_offset=40), + Assign( + [ + Name( + 'children', + Store(), + lineno=16, + col_offset=4, + end_lineno=16, + end_col_offset=12)], + List( + [], + Load(), + lineno=16, + col_offset=15, + end_lineno=16, + end_col_offset=17), + lineno=16, + col_offset=4, + end_lineno=16, + end_col_offset=17), + While( + Call( + Attribute( + Name( + 'input', + Load(), + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=15), + 'expect', + Load(), + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=22), + [ + Constant( + ';', + lineno=17, + col_offset=23, + end_lineno=17, + end_col_offset=26)], + [], + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=27), + [ + Expr( + Call( + Attribute( + Name( + 'children', + Load(), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=16), + 'append', + Load(), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=23), + [ + Call( + Name( + 'SgfTree', + Load(), + lineno=18, + col_offset=24, + end_lineno=18, + end_col_offset=31), + [], + [ + keyword( + 'properties', + Call( + Attribute( + Name( + 'input', + Load(), + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=48), + 'read_properties', + Load(), + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=64), + [], + [], + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=66), + lineno=18, + col_offset=32, + end_lineno=18, + end_col_offset=66)], + lineno=18, + col_offset=24, + end_lineno=18, + end_col_offset=67)], + [], + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=68), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=68)], + [], + lineno=17, + col_offset=4, + end_lineno=18, + end_col_offset=68), + While( + Call( + Attribute( + Name( + 'input', + Load(), + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=15), + 'expect', + Load(), + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=22), + [ + Constant( + '(', + lineno=19, + col_offset=23, + end_lineno=19, + end_col_offset=26)], + [ + keyword( + 'advance', + Constant( + False, + lineno=19, + col_offset=36, + end_lineno=19, + end_col_offset=41), + lineno=19, + col_offset=28, + end_lineno=19, + end_col_offset=41)], + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=42), + [ + Expr( + Call( + Attribute( + Name( + 'children', + Load(), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=16), + 'append', + Load(), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=23), + [ + Call( + Name( + '_parse', + Load(), + lineno=20, + col_offset=24, + end_lineno=20, + end_col_offset=30), + [ + Name( + 'input', + Load(), + lineno=20, + col_offset=31, + end_lineno=20, + end_col_offset=36)], + [], + lineno=20, + col_offset=24, + end_lineno=20, + end_col_offset=37)], + [], + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=38), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=38)], + [], + lineno=19, + col_offset=4, + end_lineno=20, + end_col_offset=38), + Return( + Call( + Name( + 'SgfTree', + Load(), + lineno=21, + col_offset=11, + end_lineno=21, + end_col_offset=18), + [], + [ + keyword( + 'properties', + Name( + 'properties', + Load(), + lineno=21, + col_offset=30, + end_lineno=21, + end_col_offset=40), + lineno=21, + col_offset=19, + end_lineno=21, + end_col_offset=40), + keyword( + 'children', + Name( + 'children', + Load(), + lineno=21, + col_offset=51, + end_lineno=21, + end_col_offset=59), + lineno=21, + col_offset=42, + end_lineno=21, + end_col_offset=59)], + lineno=21, + col_offset=11, + end_lineno=21, + end_col_offset=60), + lineno=21, + col_offset=4, + end_lineno=21, + end_col_offset=60)], + [], + lineno=14, + col_offset=0, + end_lineno=21, + end_col_offset=60), + Expr( + Constant( + '\nFrom go_counting exercise.\nDemonstrates the use of slots.\n', + lineno=26, + col_offset=0, + end_lineno=29, + end_col_offset=3), + lineno=26, + col_offset=0, + end_lineno=29, + end_col_offset=3), + Expr( + Constant( + '\nFrom the tree_building exercise.\nThe Records() class demonstrates slots. \nThe Node() class demonstrates use of KW_ONLY sentinel.\n', + lineno=45, + col_offset=0, + end_lineno=49, + end_col_offset=3), + lineno=45, + col_offset=0, + end_lineno=49, + end_col_offset=3), + ClassDef( + 'Node', + [], + [], + [ + AnnAssign( + Name( + 'node_id', + Store(), + lineno=61, + col_offset=4, + end_lineno=61, + end_col_offset=11), + Name( + 'int', + Load(), + lineno=61, + col_offset=13, + end_lineno=61, + end_col_offset=16), + Constant( + 0, + lineno=61, + col_offset=19, + end_lineno=61, + end_col_offset=20), + 1, + lineno=61, + col_offset=4, + end_lineno=61, + end_col_offset=20), + AnnAssign( + Name( + 'children', + Store(), + lineno=63, + col_offset=4, + end_lineno=63, + end_col_offset=12), + Name( + 'list', + Load(), + lineno=63, + col_offset=14, + end_lineno=63, + end_col_offset=18), + Call( + Name( + 'field', + Load(), + lineno=63, + col_offset=21, + end_lineno=63, + end_col_offset=26), + [], + [ + keyword( + 'default_factory', + Name( + 'list', + Load(), + lineno=63, + col_offset=43, + end_lineno=63, + end_col_offset=47), + lineno=63, + col_offset=27, + end_lineno=63, + end_col_offset=47)], + lineno=63, + col_offset=21, + end_lineno=63, + end_col_offset=48), + 1, + lineno=63, + col_offset=4, + end_lineno=63, + end_col_offset=48)], + [ + Name( + 'dataclass', + Load(), + lineno=59, + col_offset=1, + end_lineno=59, + end_col_offset=10)], + lineno=60, + col_offset=0, + end_lineno=63, + end_col_offset=48), + FunctionDef( + 'BuildTree', + arguments( + [], + [ + arg( + 'records', + lineno=65, + col_offset=14, + end_lineno=65, + end_col_offset=21)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ + Expr( + Call( + Attribute( + Name( + 'records', + Load(), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=11), + 'sort', + Load(), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=16), + [], + [], + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=18), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=18), + Assign( + [ + Name( + 'trees', + Store(), + lineno=69, + col_offset=4, + end_lineno=69, + end_col_offset=9)], + List( + [], + Load(), + lineno=69, + col_offset=12, + end_lineno=69, + end_col_offset=14), + lineno=69, + col_offset=4, + end_lineno=69, + end_col_offset=14), + For( + Name( + 'record', + Store(), + lineno=70, + col_offset=8, + end_lineno=70, + end_col_offset=14), + Name( + 'records', + Load(), + lineno=70, + col_offset=18, + end_lineno=70, + end_col_offset=25), + [ + Expr( + Call( + Attribute( + Name( + 'trees', + Load(), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=13), + 'append', + Load(), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=20), + [ + Call( + Name( + 'Node', + Load(), + lineno=71, + col_offset=21, + end_lineno=71, + end_col_offset=25), + [ + Attribute( + Name( + 'record', + Load(), + lineno=71, + col_offset=26, + end_lineno=71, + end_col_offset=32), + 'record_id', + Load(), + lineno=71, + col_offset=26, + end_lineno=71, + end_col_offset=42)], + [], + lineno=71, + col_offset=21, + end_lineno=71, + end_col_offset=43)], + [], + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=44), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=44)], + [], + lineno=70, + col_offset=4, + end_lineno=71, + end_col_offset=44), + For( + Name( + 'record', + Store(), + lineno=74, + col_offset=8, + end_lineno=74, + end_col_offset=14), + Subscript( + Name( + 'records', + Load(), + lineno=74, + col_offset=18, + end_lineno=74, + end_col_offset=25), + Slice( + Constant( + 1, + lineno=74, + col_offset=26, + end_lineno=74, + end_col_offset=27), + lineno=74, + col_offset=26, + end_lineno=74, + end_col_offset=28), + Load(), + lineno=74, + col_offset=18, + end_lineno=74, + end_col_offset=29), + [ + Assign( + [ + Name( + 'parent', + Store(), + lineno=75, + col_offset=8, + end_lineno=75, + end_col_offset=14)], + Subscript( + Name( + 'trees', + Load(), + lineno=75, + col_offset=17, + end_lineno=75, + end_col_offset=22), + Attribute( + Name( + 'record', + Load(), + lineno=75, + col_offset=23, + end_lineno=75, + end_col_offset=29), + 'parent_id', + Load(), + lineno=75, + col_offset=23, + end_lineno=75, + end_col_offset=39), + Load(), + lineno=75, + col_offset=17, + end_lineno=75, + end_col_offset=40), + lineno=75, + col_offset=8, + end_lineno=75, + end_col_offset=40), + Assign( + [ + Name( + 'child', + Store(), + lineno=76, + col_offset=8, + end_lineno=76, + end_col_offset=13)], + Subscript( + Name( + 'trees', + Load(), + lineno=76, + col_offset=16, + end_lineno=76, + end_col_offset=21), + Attribute( + Name( + 'record', + Load(), + lineno=76, + col_offset=22, + end_lineno=76, + end_col_offset=28), + 'record_id', + Load(), + lineno=76, + col_offset=22, + end_lineno=76, + end_col_offset=38), + Load(), + lineno=76, + col_offset=16, + end_lineno=76, + end_col_offset=39), + lineno=76, + col_offset=8, + end_lineno=76, + end_col_offset=39), + Expr( + Call( + Attribute( + Attribute( + Name( + 'parent', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=14), + 'children', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=23), + 'append', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=30), + [ + Name( + 'child', + Load(), + lineno=77, + col_offset=31, + end_lineno=77, + end_col_offset=36)], + [], + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=37), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=37)], + [], + lineno=74, + col_offset=4, + end_lineno=77, + end_col_offset=37), + Return( + Subscript( + Name( + 'trees', + Load(), + lineno=79, + col_offset=11, + end_lineno=79, + end_col_offset=16), + Constant( + 0, + lineno=79, + col_offset=17, + end_lineno=79, + end_col_offset=18), + Load(), + lineno=79, + col_offset=11, + end_lineno=79, + end_col_offset=19), + lineno=79, + col_offset=4, + end_lineno=79, + end_col_offset=19)], + [], + lineno=65, + col_offset=0, + end_lineno=79, + end_col_offset=19)], + []) +## END TREE BEFORE ## + +## BEGIN NORMALIZED TREE ## +Module( + [ + ImportFrom( + 'dataclasses', + [ + alias( + 'dataclass', + lineno=1, + col_offset=24, + end_lineno=1, + end_col_offset=33), + alias( + 'field', + lineno=1, + col_offset=35, + end_lineno=1, + end_col_offset=40), + alias( + 'KW_ONLY', + lineno=1, + col_offset=42, + end_lineno=1, + end_col_offset=49)], + 0, + lineno=1, + col_offset=0, + end_lineno=1, + end_col_offset=49), + Expr( + Constant( + '\nFrom the `sgf_parsing` exercise\nDemonstrates the combined use of slots and kw_only as parameters to @dataclass\n', + lineno=5, + col_offset=0, + end_lineno=8, + end_col_offset=3), + lineno=5, + col_offset=0, + end_lineno=8, + end_col_offset=3), + ClassDef( + 'placeholder_0', + [], + [], + [ + Assign( + [ + Name( + 'placeholder_1', + Store(), + lineno=11, + col_offset=4, + end_lineno=11, + end_col_offset=14)], + Call( + Name( + 'field', + Load(), + lineno=11, + col_offset=23, + end_lineno=11, + end_col_offset=28), + [], + [ + keyword( + 'placeholder_2', + Name( + 'dict', + Load(), + lineno=11, + col_offset=45, + end_lineno=11, + end_col_offset=49), + lineno=11, + col_offset=29, + end_lineno=11, + end_col_offset=49)], + lineno=11, + col_offset=23, + end_lineno=11, + end_col_offset=50), + lineno=11), + Assign( + [ + Name( + 'placeholder_3', + Store(), + lineno=12, + col_offset=4, + end_lineno=12, + end_col_offset=12)], + Call( + Name( + 'field', + Load(), + lineno=12, + col_offset=21, + end_lineno=12, + end_col_offset=26), + [], + [ + keyword( + 'placeholder_2', + Name( + 'list', + Load(), + lineno=12, + col_offset=43, + end_lineno=12, + end_col_offset=47), + lineno=12, + col_offset=27, + end_lineno=12, + end_col_offset=47)], + lineno=12, + col_offset=21, + end_lineno=12, + end_col_offset=48), + lineno=12)], + [ + Call( + Name( + 'dataclass', + Load(), + lineno=9, + col_offset=1, + end_lineno=9, + end_col_offset=10), + [], + [ + keyword( + 'placeholder_4', + Constant( + True, + lineno=9, + col_offset=18, + end_lineno=9, + end_col_offset=22), + lineno=9, + col_offset=11, + end_lineno=9, + end_col_offset=22), + keyword( + 'placeholder_5', + Constant( + True, + lineno=9, + col_offset=30, + end_lineno=9, + end_col_offset=34), + lineno=9, + col_offset=24, + end_lineno=9, + end_col_offset=34), + keyword( + 'placeholder_6', + Constant( + True, + lineno=9, + col_offset=44, + end_lineno=9, + end_col_offset=48), + lineno=9, + col_offset=36, + end_lineno=9, + end_col_offset=48)], + lineno=9, + col_offset=1, + end_lineno=9, + end_col_offset=49)], + lineno=10, + col_offset=0, + end_lineno=12, + end_col_offset=48), + FunctionDef( + 'placeholder_7', + arguments( + [], + [ + arg( + 'input', + lineno=14, + col_offset=11, + end_lineno=14, + end_col_offset=16)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ + Assign( + [ + Name( + 'placeholder_1', + Store(), + lineno=15, + col_offset=4, + end_lineno=15, + end_col_offset=14)], + Call( + Attribute( + Name( + 'input', + Load(), + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=22), + 'read_properties', + Load(), + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=38), + [], + [], + lineno=15, + col_offset=17, + end_lineno=15, + end_col_offset=40), + lineno=15, + col_offset=4, + end_lineno=15, + end_col_offset=40), + Assign( + [ + Name( + 'placeholder_3', + Store(), + lineno=16, + col_offset=4, + end_lineno=16, + end_col_offset=12)], + List( + [], + Load(), + lineno=16, + col_offset=15, + end_lineno=16, + end_col_offset=17), + lineno=16, + col_offset=4, + end_lineno=16, + end_col_offset=17), + While( + Call( + Attribute( + Name( + 'input', + Load(), + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=15), + 'expect', + Load(), + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=22), + [ + Constant( + ';', + lineno=17, + col_offset=23, + end_lineno=17, + end_col_offset=26)], + [], + lineno=17, + col_offset=10, + end_lineno=17, + end_col_offset=27), + [ + Expr( + Call( + Attribute( + Name( + 'placeholder_3', + Load(), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=16), + 'append', + Load(), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=23), + [ + Call( + Name( + 'placeholder_0', + Load(), + lineno=18, + col_offset=24, + end_lineno=18, + end_col_offset=31), + [], + [ + keyword( + 'placeholder_1', + Call( + Attribute( + Name( + 'input', + Load(), + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=48), + 'read_properties', + Load(), + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=64), + [], + [], + lineno=18, + col_offset=43, + end_lineno=18, + end_col_offset=66), + lineno=18, + col_offset=32, + end_lineno=18, + end_col_offset=66)], + lineno=18, + col_offset=24, + end_lineno=18, + end_col_offset=67)], + [], + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=68), + lineno=18, + col_offset=8, + end_lineno=18, + end_col_offset=68)], + [], + lineno=17, + col_offset=4, + end_lineno=18, + end_col_offset=68), + While( + Call( + Attribute( + Name( + 'input', + Load(), + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=15), + 'expect', + Load(), + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=22), + [ + Constant( + '(', + lineno=19, + col_offset=23, + end_lineno=19, + end_col_offset=26)], + [ + keyword( + 'placeholder_8', + Constant( + False, + lineno=19, + col_offset=36, + end_lineno=19, + end_col_offset=41), + lineno=19, + col_offset=28, + end_lineno=19, + end_col_offset=41)], + lineno=19, + col_offset=10, + end_lineno=19, + end_col_offset=42), + [ + Expr( + Call( + Attribute( + Name( + 'placeholder_3', + Load(), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=16), + 'append', + Load(), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=23), + [ + Call( + Name( + 'placeholder_7', + Load(), + lineno=20, + col_offset=24, + end_lineno=20, + end_col_offset=30), + [ + Name( + 'input', + Load(), + lineno=20, + col_offset=31, + end_lineno=20, + end_col_offset=36)], + [], + lineno=20, + col_offset=24, + end_lineno=20, + end_col_offset=37)], + [], + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=38), + lineno=20, + col_offset=8, + end_lineno=20, + end_col_offset=38)], + [], + lineno=19, + col_offset=4, + end_lineno=20, + end_col_offset=38), + Return( + Call( + Name( + 'placeholder_0', + Load(), + lineno=21, + col_offset=11, + end_lineno=21, + end_col_offset=18), + [], + [ + keyword( + 'placeholder_1', + Name( + 'placeholder_1', + Load(), + lineno=21, + col_offset=30, + end_lineno=21, + end_col_offset=40), + lineno=21, + col_offset=19, + end_lineno=21, + end_col_offset=40), + keyword( + 'placeholder_3', + Name( + 'placeholder_3', + Load(), + lineno=21, + col_offset=51, + end_lineno=21, + end_col_offset=59), + lineno=21, + col_offset=42, + end_lineno=21, + end_col_offset=59)], + lineno=21, + col_offset=11, + end_lineno=21, + end_col_offset=60), + lineno=21, + col_offset=4, + end_lineno=21, + end_col_offset=60)], + [], + lineno=14, + col_offset=0, + end_lineno=21, + end_col_offset=60), + Expr( + Constant( + '\nFrom go_counting exercise.\nDemonstrates the use of slots.\n', + lineno=26, + col_offset=0, + end_lineno=29, + end_col_offset=3), + lineno=26, + col_offset=0, + end_lineno=29, + end_col_offset=3), + Expr( + Constant( + '\nFrom the tree_building exercise.\nThe Records() class demonstrates slots. \nThe Node() class demonstrates use of KW_ONLY sentinel.\n', + lineno=45, + col_offset=0, + end_lineno=49, + end_col_offset=3), + lineno=45, + col_offset=0, + end_lineno=49, + end_col_offset=3), + ClassDef( + 'placeholder_9', + [], + [], + [ + Assign( + [ + Name( + 'placeholder_10', + Store(), + lineno=61, + col_offset=4, + end_lineno=61, + end_col_offset=11)], + Constant( + 0, + lineno=61, + col_offset=19, + end_lineno=61, + end_col_offset=20), + lineno=61), + Assign( + [ + Name( + 'placeholder_3', + Store(), + lineno=63, + col_offset=4, + end_lineno=63, + end_col_offset=12)], + Call( + Name( + 'field', + Load(), + lineno=63, + col_offset=21, + end_lineno=63, + end_col_offset=26), + [], + [ + keyword( + 'placeholder_2', + Name( + 'list', + Load(), + lineno=63, + col_offset=43, + end_lineno=63, + end_col_offset=47), + lineno=63, + col_offset=27, + end_lineno=63, + end_col_offset=47)], + lineno=63, + col_offset=21, + end_lineno=63, + end_col_offset=48), + lineno=63)], + [ + Name( + 'dataclass', + Load(), + lineno=59, + col_offset=1, + end_lineno=59, + end_col_offset=10)], + lineno=60, + col_offset=0, + end_lineno=63, + end_col_offset=48), + FunctionDef( + 'placeholder_11', + arguments( + [], + [ + arg( + 'placeholder_12', + lineno=65, + col_offset=14, + end_lineno=65, + end_col_offset=21)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ + Expr( + Call( + Attribute( + Name( + 'placeholder_12', + Load(), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=11), + 'sort', + Load(), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=16), + [], + [], + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=18), + lineno=66, + col_offset=4, + end_lineno=66, + end_col_offset=18), + Assign( + [ + Name( + 'placeholder_13', + Store(), + lineno=69, + col_offset=4, + end_lineno=69, + end_col_offset=9)], + List( + [], + Load(), + lineno=69, + col_offset=12, + end_lineno=69, + end_col_offset=14), + lineno=69, + col_offset=4, + end_lineno=69, + end_col_offset=14), + For( + Name( + 'placeholder_14', + Store(), + lineno=70, + col_offset=8, + end_lineno=70, + end_col_offset=14), + Name( + 'placeholder_12', + Load(), + lineno=70, + col_offset=18, + end_lineno=70, + end_col_offset=25), + [ + Expr( + Call( + Attribute( + Name( + 'placeholder_13', + Load(), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=13), + 'append', + Load(), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=20), + [ + Call( + Name( + 'placeholder_9', + Load(), + lineno=71, + col_offset=21, + end_lineno=71, + end_col_offset=25), + [ + Attribute( + Name( + 'placeholder_14', + Load(), + lineno=71, + col_offset=26, + end_lineno=71, + end_col_offset=32), + 'record_id', + Load(), + lineno=71, + col_offset=26, + end_lineno=71, + end_col_offset=42)], + [], + lineno=71, + col_offset=21, + end_lineno=71, + end_col_offset=43)], + [], + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=44), + lineno=71, + col_offset=8, + end_lineno=71, + end_col_offset=44)], + [], + lineno=70, + col_offset=4, + end_lineno=71, + end_col_offset=44), + For( + Name( + 'placeholder_14', + Store(), + lineno=74, + col_offset=8, + end_lineno=74, + end_col_offset=14), + Subscript( + Name( + 'placeholder_12', + Load(), + lineno=74, + col_offset=18, + end_lineno=74, + end_col_offset=25), + Slice( + Constant( + 1, + lineno=74, + col_offset=26, + end_lineno=74, + end_col_offset=27), + lineno=74, + col_offset=26, + end_lineno=74, + end_col_offset=28), + Load(), + lineno=74, + col_offset=18, + end_lineno=74, + end_col_offset=29), + [ + Assign( + [ + Name( + 'placeholder_15', + Store(), + lineno=75, + col_offset=8, + end_lineno=75, + end_col_offset=14)], + Subscript( + Name( + 'placeholder_13', + Load(), + lineno=75, + col_offset=17, + end_lineno=75, + end_col_offset=22), + Attribute( + Name( + 'placeholder_14', + Load(), + lineno=75, + col_offset=23, + end_lineno=75, + end_col_offset=29), + 'parent_id', + Load(), + lineno=75, + col_offset=23, + end_lineno=75, + end_col_offset=39), + Load(), + lineno=75, + col_offset=17, + end_lineno=75, + end_col_offset=40), + lineno=75, + col_offset=8, + end_lineno=75, + end_col_offset=40), + Assign( + [ + Name( + 'placeholder_16', + Store(), + lineno=76, + col_offset=8, + end_lineno=76, + end_col_offset=13)], + Subscript( + Name( + 'placeholder_13', + Load(), + lineno=76, + col_offset=16, + end_lineno=76, + end_col_offset=21), + Attribute( + Name( + 'placeholder_14', + Load(), + lineno=76, + col_offset=22, + end_lineno=76, + end_col_offset=28), + 'record_id', + Load(), + lineno=76, + col_offset=22, + end_lineno=76, + end_col_offset=38), + Load(), + lineno=76, + col_offset=16, + end_lineno=76, + end_col_offset=39), + lineno=76, + col_offset=8, + end_lineno=76, + end_col_offset=39), + Expr( + Call( + Attribute( + Attribute( + Name( + 'placeholder_15', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=14), + 'placeholder_3', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=23), + 'append', + Load(), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=30), + [ + Name( + 'placeholder_16', + Load(), + lineno=77, + col_offset=31, + end_lineno=77, + end_col_offset=36)], + [], + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=37), + lineno=77, + col_offset=8, + end_lineno=77, + end_col_offset=37)], + [], + lineno=74, + col_offset=4, + end_lineno=77, + end_col_offset=37), + Return( + Subscript( + Name( + 'placeholder_13', + Load(), + lineno=79, + col_offset=11, + end_lineno=79, + end_col_offset=16), + Constant( + 0, + lineno=79, + col_offset=17, + end_lineno=79, + end_col_offset=18), + Load(), + lineno=79, + col_offset=11, + end_lineno=79, + end_col_offset=19), + lineno=79, + col_offset=4, + end_lineno=79, + end_col_offset=19)], + [], + lineno=65, + col_offset=0, + end_lineno=79, + end_col_offset=19)], + []) +## END NORMALIZED TREE ## \ No newline at end of file diff --git a/test/example-dataclass-normalization/representation.txt b/test/example-dataclass-normalization/representation.txt new file mode 100644 index 0000000..6df4247 --- /dev/null +++ b/test/example-dataclass-normalization/representation.txt @@ -0,0 +1 @@ +Module([ImportFrom('dataclasses', [alias('dataclass', lineno=1, col_offset=24, end_lineno=1, end_col_offset=33), alias('field', lineno=1, col_offset=35, end_lineno=1, end_col_offset=40), alias('KW_ONLY', lineno=1, col_offset=42, end_lineno=1, end_col_offset=49)], 0, lineno=1, col_offset=0, end_lineno=1, end_col_offset=49), Expr(Constant('\nFrom the `sgf_parsing` exercise\nDemonstrates the combined use of slots and kw_only as parameters to @dataclass\n', lineno=5, col_offset=0, end_lineno=8, end_col_offset=3), lineno=5, col_offset=0, end_lineno=8, end_col_offset=3), ClassDef('placeholder_0', [], [], [Assign([Name('placeholder_1', Store(), lineno=11, col_offset=4, end_lineno=11, end_col_offset=14)], Call(Name('field', Load(), lineno=11, col_offset=23, end_lineno=11, end_col_offset=28), [], [keyword('placeholder_2', Name('dict', Load(), lineno=11, col_offset=45, end_lineno=11, end_col_offset=49), lineno=11, col_offset=29, end_lineno=11, end_col_offset=49)], lineno=11, col_offset=23, end_lineno=11, end_col_offset=50), lineno=11), Assign([Name('placeholder_3', Store(), lineno=12, col_offset=4, end_lineno=12, end_col_offset=12)], Call(Name('field', Load(), lineno=12, col_offset=21, end_lineno=12, end_col_offset=26), [], [keyword('placeholder_2', Name('list', Load(), lineno=12, col_offset=43, end_lineno=12, end_col_offset=47), lineno=12, col_offset=27, end_lineno=12, end_col_offset=47)], lineno=12, col_offset=21, end_lineno=12, end_col_offset=48), lineno=12)], [Call(Name('dataclass', Load(), lineno=9, col_offset=1, end_lineno=9, end_col_offset=10), [], [keyword('placeholder_4', Constant(True, lineno=9, col_offset=18, end_lineno=9, end_col_offset=22), lineno=9, col_offset=11, end_lineno=9, end_col_offset=22), keyword('placeholder_5', Constant(True, lineno=9, col_offset=30, end_lineno=9, end_col_offset=34), lineno=9, col_offset=24, end_lineno=9, end_col_offset=34), keyword('placeholder_6', Constant(True, lineno=9, col_offset=44, end_lineno=9, end_col_offset=48), lineno=9, col_offset=36, end_lineno=9, end_col_offset=48)], lineno=9, col_offset=1, end_lineno=9, end_col_offset=49)], lineno=10, col_offset=0, end_lineno=12, end_col_offset=48), FunctionDef('placeholder_7', arguments([], [arg('input', lineno=14, col_offset=11, end_lineno=14, end_col_offset=16)], kwonlyargs=[], kw_defaults=[], defaults=[]), [Assign([Name('placeholder_1', Store(), lineno=15, col_offset=4, end_lineno=15, end_col_offset=14)], Call(Attribute(Name('input', Load(), lineno=15, col_offset=17, end_lineno=15, end_col_offset=22), 'read_properties', Load(), lineno=15, col_offset=17, end_lineno=15, end_col_offset=38), [], [], lineno=15, col_offset=17, end_lineno=15, end_col_offset=40), lineno=15, col_offset=4, end_lineno=15, end_col_offset=40), Assign([Name('placeholder_3', Store(), lineno=16, col_offset=4, end_lineno=16, end_col_offset=12)], List([], Load(), lineno=16, col_offset=15, end_lineno=16, end_col_offset=17), lineno=16, col_offset=4, end_lineno=16, end_col_offset=17), While(Call(Attribute(Name('input', Load(), lineno=17, col_offset=10, end_lineno=17, end_col_offset=15), 'expect', Load(), lineno=17, col_offset=10, end_lineno=17, end_col_offset=22), [Constant(';', lineno=17, col_offset=23, end_lineno=17, end_col_offset=26)], [], lineno=17, col_offset=10, end_lineno=17, end_col_offset=27), [Expr(Call(Attribute(Name('placeholder_3', Load(), lineno=18, col_offset=8, end_lineno=18, end_col_offset=16), 'append', Load(), lineno=18, col_offset=8, end_lineno=18, end_col_offset=23), [Call(Name('placeholder_0', Load(), lineno=18, col_offset=24, end_lineno=18, end_col_offset=31), [], [keyword('placeholder_1', Call(Attribute(Name('input', Load(), lineno=18, col_offset=43, end_lineno=18, end_col_offset=48), 'read_properties', Load(), lineno=18, col_offset=43, end_lineno=18, end_col_offset=64), [], [], lineno=18, col_offset=43, end_lineno=18, end_col_offset=66), lineno=18, col_offset=32, end_lineno=18, end_col_offset=66)], lineno=18, col_offset=24, end_lineno=18, end_col_offset=67)], [], lineno=18, col_offset=8, end_lineno=18, end_col_offset=68), lineno=18, col_offset=8, end_lineno=18, end_col_offset=68)], [], lineno=17, col_offset=4, end_lineno=18, end_col_offset=68), While(Call(Attribute(Name('input', Load(), lineno=19, col_offset=10, end_lineno=19, end_col_offset=15), 'expect', Load(), lineno=19, col_offset=10, end_lineno=19, end_col_offset=22), [Constant('(', lineno=19, col_offset=23, end_lineno=19, end_col_offset=26)], [keyword('placeholder_8', Constant(False, lineno=19, col_offset=36, end_lineno=19, end_col_offset=41), lineno=19, col_offset=28, end_lineno=19, end_col_offset=41)], lineno=19, col_offset=10, end_lineno=19, end_col_offset=42), [Expr(Call(Attribute(Name('placeholder_3', Load(), lineno=20, col_offset=8, end_lineno=20, end_col_offset=16), 'append', Load(), lineno=20, col_offset=8, end_lineno=20, end_col_offset=23), [Call(Name('placeholder_7', Load(), lineno=20, col_offset=24, end_lineno=20, end_col_offset=30), [Name('input', Load(), lineno=20, col_offset=31, end_lineno=20, end_col_offset=36)], [], lineno=20, col_offset=24, end_lineno=20, end_col_offset=37)], [], lineno=20, col_offset=8, end_lineno=20, end_col_offset=38), lineno=20, col_offset=8, end_lineno=20, end_col_offset=38)], [], lineno=19, col_offset=4, end_lineno=20, end_col_offset=38), Return(Call(Name('placeholder_0', Load(), lineno=21, col_offset=11, end_lineno=21, end_col_offset=18), [], [keyword('placeholder_1', Name('placeholder_1', Load(), lineno=21, col_offset=30, end_lineno=21, end_col_offset=40), lineno=21, col_offset=19, end_lineno=21, end_col_offset=40), keyword('placeholder_3', Name('placeholder_3', Load(), lineno=21, col_offset=51, end_lineno=21, end_col_offset=59), lineno=21, col_offset=42, end_lineno=21, end_col_offset=59)], lineno=21, col_offset=11, end_lineno=21, end_col_offset=60), lineno=21, col_offset=4, end_lineno=21, end_col_offset=60)], [], lineno=14, col_offset=0, end_lineno=21, end_col_offset=60), Expr(Constant('\nFrom go_counting exercise.\nDemonstrates the use of slots.\n', lineno=26, col_offset=0, end_lineno=29, end_col_offset=3), lineno=26, col_offset=0, end_lineno=29, end_col_offset=3), Expr(Constant('\nFrom the tree_building exercise.\nThe Records() class demonstrates slots. \nThe Node() class demonstrates use of KW_ONLY sentinel.\n', lineno=45, col_offset=0, end_lineno=49, end_col_offset=3), lineno=45, col_offset=0, end_lineno=49, end_col_offset=3), ClassDef('placeholder_9', [], [], [Assign([Name('placeholder_10', Store(), lineno=61, col_offset=4, end_lineno=61, end_col_offset=11)], Constant(0, lineno=61, col_offset=19, end_lineno=61, end_col_offset=20), lineno=61), Assign([Name('placeholder_3', Store(), lineno=63, col_offset=4, end_lineno=63, end_col_offset=12)], Call(Name('field', Load(), lineno=63, col_offset=21, end_lineno=63, end_col_offset=26), [], [keyword('placeholder_2', Name('list', Load(), lineno=63, col_offset=43, end_lineno=63, end_col_offset=47), lineno=63, col_offset=27, end_lineno=63, end_col_offset=47)], lineno=63, col_offset=21, end_lineno=63, end_col_offset=48), lineno=63)], [Name('dataclass', Load(), lineno=59, col_offset=1, end_lineno=59, end_col_offset=10)], lineno=60, col_offset=0, end_lineno=63, end_col_offset=48), FunctionDef('placeholder_11', arguments([], [arg('placeholder_12', lineno=65, col_offset=14, end_lineno=65, end_col_offset=21)], kwonlyargs=[], kw_defaults=[], defaults=[]), [Expr(Call(Attribute(Name('placeholder_12', Load(), lineno=66, col_offset=4, end_lineno=66, end_col_offset=11), 'sort', Load(), lineno=66, col_offset=4, end_lineno=66, end_col_offset=16), [], [], lineno=66, col_offset=4, end_lineno=66, end_col_offset=18), lineno=66, col_offset=4, end_lineno=66, end_col_offset=18), Assign([Name('placeholder_13', Store(), lineno=69, col_offset=4, end_lineno=69, end_col_offset=9)], List([], Load(), lineno=69, col_offset=12, end_lineno=69, end_col_offset=14), lineno=69, col_offset=4, end_lineno=69, end_col_offset=14), For(Name('placeholder_14', Store(), lineno=70, col_offset=8, end_lineno=70, end_col_offset=14), Name('placeholder_12', Load(), lineno=70, col_offset=18, end_lineno=70, end_col_offset=25), [Expr(Call(Attribute(Name('placeholder_13', Load(), lineno=71, col_offset=8, end_lineno=71, end_col_offset=13), 'append', Load(), lineno=71, col_offset=8, end_lineno=71, end_col_offset=20), [Call(Name('placeholder_9', Load(), lineno=71, col_offset=21, end_lineno=71, end_col_offset=25), [Attribute(Name('placeholder_14', Load(), lineno=71, col_offset=26, end_lineno=71, end_col_offset=32), 'record_id', Load(), lineno=71, col_offset=26, end_lineno=71, end_col_offset=42)], [], lineno=71, col_offset=21, end_lineno=71, end_col_offset=43)], [], lineno=71, col_offset=8, end_lineno=71, end_col_offset=44), lineno=71, col_offset=8, end_lineno=71, end_col_offset=44)], [], lineno=70, col_offset=4, end_lineno=71, end_col_offset=44), For(Name('placeholder_14', Store(), lineno=74, col_offset=8, end_lineno=74, end_col_offset=14), Subscript(Name('placeholder_12', Load(), lineno=74, col_offset=18, end_lineno=74, end_col_offset=25), Slice(Constant(1, lineno=74, col_offset=26, end_lineno=74, end_col_offset=27), lineno=74, col_offset=26, end_lineno=74, end_col_offset=28), Load(), lineno=74, col_offset=18, end_lineno=74, end_col_offset=29), [Assign([Name('placeholder_15', Store(), lineno=75, col_offset=8, end_lineno=75, end_col_offset=14)], Subscript(Name('placeholder_13', Load(), lineno=75, col_offset=17, end_lineno=75, end_col_offset=22), Attribute(Name('placeholder_14', Load(), lineno=75, col_offset=23, end_lineno=75, end_col_offset=29), 'parent_id', Load(), lineno=75, col_offset=23, end_lineno=75, end_col_offset=39), Load(), lineno=75, col_offset=17, end_lineno=75, end_col_offset=40), lineno=75, col_offset=8, end_lineno=75, end_col_offset=40), Assign([Name('placeholder_16', Store(), lineno=76, col_offset=8, end_lineno=76, end_col_offset=13)], Subscript(Name('placeholder_13', Load(), lineno=76, col_offset=16, end_lineno=76, end_col_offset=21), Attribute(Name('placeholder_14', Load(), lineno=76, col_offset=22, end_lineno=76, end_col_offset=28), 'record_id', Load(), lineno=76, col_offset=22, end_lineno=76, end_col_offset=38), Load(), lineno=76, col_offset=16, end_lineno=76, end_col_offset=39), lineno=76, col_offset=8, end_lineno=76, end_col_offset=39), Expr(Call(Attribute(Attribute(Name('placeholder_15', Load(), lineno=77, col_offset=8, end_lineno=77, end_col_offset=14), 'placeholder_3', Load(), lineno=77, col_offset=8, end_lineno=77, end_col_offset=23), 'append', Load(), lineno=77, col_offset=8, end_lineno=77, end_col_offset=30), [Name('placeholder_16', Load(), lineno=77, col_offset=31, end_lineno=77, end_col_offset=36)], [], lineno=77, col_offset=8, end_lineno=77, end_col_offset=37), lineno=77, col_offset=8, end_lineno=77, end_col_offset=37)], [], lineno=74, col_offset=4, end_lineno=77, end_col_offset=37), Return(Subscript(Name('placeholder_13', Load(), lineno=79, col_offset=11, end_lineno=79, end_col_offset=16), Constant(0, lineno=79, col_offset=17, end_lineno=79, end_col_offset=18), Load(), lineno=79, col_offset=11, end_lineno=79, end_col_offset=19), lineno=79, col_offset=4, end_lineno=79, end_col_offset=19)], [], lineno=65, col_offset=0, end_lineno=79, end_col_offset=19)], []) \ No newline at end of file