From a094c4a0dea9a00b8e3cb30550f4cc65761d9432 Mon Sep 17 00:00:00 2001 From: brocla Date: Tue, 19 Mar 2024 19:43:24 -0600 Subject: [PATCH] Add a second example of parens and Context Managers. - uses two copies of `localcontext` --- .../example_parencontext_normalization.py | 86 +- .../mapping.json | 28 +- .../representation.out | 1820 ++++++++++------- .../representation.txt | 2 +- 4 files changed, 1186 insertions(+), 750 deletions(-) diff --git a/test/example-parencontext-normalization/example_parencontext_normalization.py b/test/example-parencontext-normalization/example_parencontext_normalization.py index fb670c4..be4ddd1 100644 --- a/test/example-parencontext-normalization/example_parencontext_normalization.py +++ b/test/example-parencontext-normalization/example_parencontext_normalization.py @@ -1,6 +1,49 @@ """Examples of Parenthesized Context Managers. New feature in Python 3.10""" + +# This example shows parens around two `localcontext` context mangers. +"""Calculate the fixed interest rate.""" + +from decimal import ROUND_DOWN, ROUND_UP, Decimal, localcontext +import pandas as pd + + +def calc_fixed_rate(spot_price: pd.Series, position_duration: Decimal) -> pd.Series: + """Calculates the fixed rate given trade data. + + Arguments + --------- + spot_price: pd.Series + The spot price. + position_duration: Decimal + The position duration in seconds. + + Returns + ------- + pd.Series + The fixed interest rate. + """ + # Position duration (in seconds) in terms of fraction of year + # This div should round up + # This replicates div up in fixed point + with (localcontext() as ctx_time, + localcontext() as ctx_rate): + ctx_time.prec = 18 + ctx_time.rounding = ROUND_UP + + ctx_rate.prec = 12 + ctx_rate.rounding = ROUND_DOWN + + annualized_time = position_duration / Decimal(60 * 60 * 24 * 365) + fixed_rate = (1 - spot_price) / (spot_price * annualized_time) # type: ignore + return fixed_rate + + + + + +# This example shows a CLI that opens two files with context managers that are grouped by parens. #!/usr/bin/python3 """convert json to jsonl""" @@ -28,45 +71,4 @@ def parse_args(): return args if __name__ == "__main__": - main() - - - - - -# Examples from python docs -# https://docs.python.org/3/whatsnew/3.10.html#parenthesized-context-managers - - def CtxManager(): pass - def CtxManager1(): pass - def CtxManager2(): pass - def CtxManager3(): pass - - with (CtxManager() as example): - ... - - with ( - CtxManager1(), - CtxManager2() - ): - ... - - with (CtxManager1() as example, - CtxManager2()): - ... - - with (CtxManager1(), - CtxManager2() as example): - ... - - with ( - CtxManager1() as example1, - CtxManager2() as example2 - ): - ... - with ( - CtxManager1() as example1, - CtxManager2() as example2, - CtxManager3() as example3, - ): - ... \ No newline at end of file + main() \ No newline at end of file diff --git a/test/example-parencontext-normalization/mapping.json b/test/example-parencontext-normalization/mapping.json index a048c72..207d14d 100644 --- a/test/example-parencontext-normalization/mapping.json +++ b/test/example-parencontext-normalization/mapping.json @@ -1,11 +1,21 @@ { - "placeholder_0": "main", - "placeholder_1": "args", - "placeholder_2": "in_file", - "placeholder_3": "mode", - "placeholder_4": "out_file", - "placeholder_5": "records", - "placeholder_6": "record", - "placeholder_7": "parse_args", - "placeholder_8": "parser" + "placeholder_0": "pd", + "placeholder_1": "calc_fixed_rate", + "placeholder_2": "spot_price", + "placeholder_3": "position_duration", + "placeholder_4": "ctx_time", + "placeholder_5": "ctx_rate", + "placeholder_6": "prec", + "placeholder_7": "rounding", + "placeholder_8": "annualized_time", + "placeholder_9": "fixed_rate", + "placeholder_10": "main", + "placeholder_11": "args", + "placeholder_12": "in_file", + "placeholder_13": "mode", + "placeholder_14": "out_file", + "placeholder_15": "records", + "placeholder_16": "record", + "placeholder_17": "parse_args", + "placeholder_18": "parser" } \ No newline at end of file diff --git a/test/example-parencontext-normalization/representation.out b/test/example-parencontext-normalization/representation.out index 5c9319c..2b63791 100644 --- a/test/example-parencontext-normalization/representation.out +++ b/test/example-parencontext-normalization/representation.out @@ -1,25 +1,41 @@ ## BEGIN NORMALIZED CODE ## -"""convert json to jsonl""" +"""Calculate the fixed interest rate.""" +from decimal import ROUND_DOWN, ROUND_UP, Decimal, localcontext +import pandas as placeholder_0 + + +def placeholder_1(placeholder_2, placeholder_3): + with localcontext() as placeholder_4, localcontext() as placeholder_5: + placeholder_4.placeholder_6 = 18 + placeholder_4.placeholder_7 = ROUND_UP + placeholder_5.placeholder_6 = 12 + placeholder_5.placeholder_7 = ROUND_DOWN + placeholder_8 = placeholder_3 / Decimal(60 * 60 * 24 * 365) + placeholder_9 = (1 - placeholder_2) / (placeholder_2 * placeholder_8) + return placeholder_9 + + +"convert json to jsonl" from argparse import ArgumentParser import json -def placeholder_0(): - placeholder_1 = parse_args() - with open(placeholder_1.in_filename) as placeholder_2, open( - placeholder_1.out_filename, placeholder_3="wt" - ) as placeholder_4: - placeholder_5 = json.load(placeholder_2) - for placeholder_6 in placeholder_5: - placeholder_4.write(json.dumps(placeholder_6) + "\n") +def placeholder_10(): + placeholder_11 = parse_args() + with open(placeholder_11.in_filename) as placeholder_12, open( + placeholder_11.out_filename, placeholder_13="wt" + ) as placeholder_14: + placeholder_15 = json.load(placeholder_12) + for placeholder_16 in placeholder_15: + placeholder_14.write(json.dumps(placeholder_16) + "\n") -def placeholder_7(): - placeholder_8 = ArgumentParser() - placeholder_8.add_argument("in_filename") - placeholder_8.add_argument("out_filename") - placeholder_1 = placeholder_8.placeholder_7() - return placeholder_1 +def placeholder_17(): + placeholder_18 = ArgumentParser() + placeholder_18.add_argument("in_filename") + placeholder_18.add_argument("out_filename") + placeholder_11 = placeholder_18.placeholder_17() + return placeholder_11 ## END NORMALIZED CODE ## @@ -37,42 +53,479 @@ Module( col_offset=0, end_lineno=1, end_col_offset=76), + Expr( + Constant( + 'Calculate the fixed interest rate.', + lineno=6, + col_offset=0, + end_lineno=6, + end_col_offset=40), + lineno=6, + col_offset=0, + end_lineno=6, + end_col_offset=40), + ImportFrom( + 'decimal', + [ + alias( + 'ROUND_DOWN', + lineno=8, + col_offset=20, + end_lineno=8, + end_col_offset=30), + alias( + 'ROUND_UP', + lineno=8, + col_offset=32, + end_lineno=8, + end_col_offset=40), + alias( + 'Decimal', + lineno=8, + col_offset=42, + end_lineno=8, + end_col_offset=49), + alias( + 'localcontext', + lineno=8, + col_offset=51, + end_lineno=8, + end_col_offset=63)], + 0, + lineno=8, + col_offset=0, + end_lineno=8, + end_col_offset=63), + Import( + [ + alias( + 'pandas', + 'pd', + lineno=9, + col_offset=7, + end_lineno=9, + end_col_offset=19)], + lineno=9, + col_offset=0, + end_lineno=9, + end_col_offset=19), + FunctionDef( + 'calc_fixed_rate', + arguments( + [], + [ + arg( + 'spot_price', + Attribute( + Name( + 'pd', + Load(), + lineno=12, + col_offset=32, + end_lineno=12, + end_col_offset=34), + 'Series', + Load(), + lineno=12, + col_offset=32, + end_lineno=12, + end_col_offset=41), + lineno=12, + col_offset=20, + end_lineno=12, + end_col_offset=41), + arg( + 'position_duration', + Name( + 'Decimal', + Load(), + lineno=12, + col_offset=62, + end_lineno=12, + end_col_offset=69), + lineno=12, + col_offset=43, + end_lineno=12, + end_col_offset=69)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ + Expr( + Constant( + 'Calculates the fixed rate given trade data.\n\n Arguments\n ---------\n spot_price: pd.Series\n The spot price.\n position_duration: Decimal\n The position duration in seconds.\n\n Returns\n -------\n pd.Series\n The fixed interest rate.\n ', + lineno=13, + col_offset=4, + end_lineno=26, + end_col_offset=7), + lineno=13, + col_offset=4, + end_lineno=26, + end_col_offset=7), + With( + [ + withitem( + Call( + Name( + 'localcontext', + Load(), + lineno=30, + col_offset=10, + end_lineno=30, + end_col_offset=22), + [], + [], + lineno=30, + col_offset=10, + end_lineno=30, + end_col_offset=24), + Name( + 'ctx_time', + Store(), + lineno=30, + col_offset=28, + end_lineno=30, + end_col_offset=36)), + withitem( + Call( + Name( + 'localcontext', + Load(), + lineno=31, + col_offset=10, + end_lineno=31, + end_col_offset=22), + [], + [], + lineno=31, + col_offset=10, + end_lineno=31, + end_col_offset=24), + Name( + 'ctx_rate', + Store(), + lineno=31, + col_offset=28, + end_lineno=31, + end_col_offset=36))], + [ + Assign( + [ + Attribute( + Name( + 'ctx_time', + Load(), + lineno=32, + col_offset=8, + end_lineno=32, + end_col_offset=16), + 'prec', + Store(), + lineno=32, + col_offset=8, + end_lineno=32, + end_col_offset=21)], + Constant( + 18, + lineno=32, + col_offset=24, + end_lineno=32, + end_col_offset=26), + lineno=32, + col_offset=8, + end_lineno=32, + end_col_offset=26), + Assign( + [ + Attribute( + Name( + 'ctx_time', + Load(), + lineno=33, + col_offset=8, + end_lineno=33, + end_col_offset=16), + 'rounding', + Store(), + lineno=33, + col_offset=8, + end_lineno=33, + end_col_offset=25)], + Name( + 'ROUND_UP', + Load(), + lineno=33, + col_offset=28, + end_lineno=33, + end_col_offset=36), + lineno=33, + col_offset=8, + end_lineno=33, + end_col_offset=36), + Assign( + [ + Attribute( + Name( + 'ctx_rate', + Load(), + lineno=35, + col_offset=8, + end_lineno=35, + end_col_offset=16), + 'prec', + Store(), + lineno=35, + col_offset=8, + end_lineno=35, + end_col_offset=21)], + Constant( + 12, + lineno=35, + col_offset=24, + end_lineno=35, + end_col_offset=26), + lineno=35, + col_offset=8, + end_lineno=35, + end_col_offset=26), + Assign( + [ + Attribute( + Name( + 'ctx_rate', + Load(), + lineno=36, + col_offset=8, + end_lineno=36, + end_col_offset=16), + 'rounding', + Store(), + lineno=36, + col_offset=8, + end_lineno=36, + end_col_offset=25)], + Name( + 'ROUND_DOWN', + Load(), + lineno=36, + col_offset=28, + end_lineno=36, + end_col_offset=38), + lineno=36, + col_offset=8, + end_lineno=36, + end_col_offset=38), + Assign( + [ + Name( + 'annualized_time', + Store(), + lineno=38, + col_offset=8, + end_lineno=38, + end_col_offset=23)], + BinOp( + Name( + 'position_duration', + Load(), + lineno=38, + col_offset=26, + end_lineno=38, + end_col_offset=43), + Div(), + Call( + Name( + 'Decimal', + Load(), + lineno=38, + col_offset=46, + end_lineno=38, + end_col_offset=53), + [ + BinOp( + BinOp( + BinOp( + Constant( + 60, + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=56), + Mult(), + Constant( + 60, + lineno=38, + col_offset=59, + end_lineno=38, + end_col_offset=61), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=61), + Mult(), + Constant( + 24, + lineno=38, + col_offset=64, + end_lineno=38, + end_col_offset=66), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=66), + Mult(), + Constant( + 365, + lineno=38, + col_offset=69, + end_lineno=38, + end_col_offset=72), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=72)], + [], + lineno=38, + col_offset=46, + end_lineno=38, + end_col_offset=73), + lineno=38, + col_offset=26, + end_lineno=38, + end_col_offset=73), + lineno=38, + col_offset=8, + end_lineno=38, + end_col_offset=73), + Assign( + [ + Name( + 'fixed_rate', + Store(), + lineno=39, + col_offset=8, + end_lineno=39, + end_col_offset=18)], + BinOp( + BinOp( + Constant( + 1, + lineno=39, + col_offset=22, + end_lineno=39, + end_col_offset=23), + Sub(), + Name( + 'spot_price', + Load(), + lineno=39, + col_offset=26, + end_lineno=39, + end_col_offset=36), + lineno=39, + col_offset=22, + end_lineno=39, + end_col_offset=36), + Div(), + BinOp( + Name( + 'spot_price', + Load(), + lineno=39, + col_offset=41, + end_lineno=39, + end_col_offset=51), + Mult(), + Name( + 'annualized_time', + Load(), + lineno=39, + col_offset=54, + end_lineno=39, + end_col_offset=69), + lineno=39, + col_offset=41, + end_lineno=39, + end_col_offset=69), + lineno=39, + col_offset=21, + end_lineno=39, + end_col_offset=70), + lineno=39, + col_offset=8, + end_lineno=39, + end_col_offset=70)], + lineno=30, + col_offset=4, + end_lineno=39, + end_col_offset=70), + Return( + Name( + 'fixed_rate', + Load(), + lineno=40, + col_offset=11, + end_lineno=40, + end_col_offset=21), + lineno=40, + col_offset=4, + end_lineno=40, + end_col_offset=21)], + [], + Attribute( + Name( + 'pd', + Load(), + lineno=12, + col_offset=74, + end_lineno=12, + end_col_offset=76), + 'Series', + Load(), + lineno=12, + col_offset=74, + end_lineno=12, + end_col_offset=83), + lineno=12, + col_offset=0, + end_lineno=40, + end_col_offset=21), Expr( Constant( 'convert json to jsonl', - lineno=5, + lineno=48, col_offset=0, - end_lineno=5, + end_lineno=48, end_col_offset=27), - lineno=5, + lineno=48, col_offset=0, - end_lineno=5, + end_lineno=48, end_col_offset=27), ImportFrom( 'argparse', [ alias( 'ArgumentParser', - lineno=7, + lineno=50, col_offset=21, - end_lineno=7, + end_lineno=50, end_col_offset=35)], 0, - lineno=7, + lineno=50, col_offset=0, - end_lineno=7, + end_lineno=50, end_col_offset=35), Import( [ alias( 'json', - lineno=8, + lineno=51, col_offset=7, - end_lineno=8, + end_lineno=51, end_col_offset=11)], - lineno=8, + lineno=51, col_offset=0, - end_lineno=8, + end_lineno=51, end_col_offset=11), FunctionDef( 'main', @@ -88,27 +541,27 @@ Module( Name( 'args', Store(), - lineno=11, + lineno=54, col_offset=4, - end_lineno=11, + end_lineno=54, end_col_offset=8)], Call( Name( 'parse_args', Load(), - lineno=11, + lineno=54, col_offset=11, - end_lineno=11, + end_lineno=54, end_col_offset=21), [], [], - lineno=11, + lineno=54, col_offset=11, - end_lineno=11, + end_lineno=54, end_col_offset=23), - lineno=11, + lineno=54, col_offset=4, - end_lineno=11, + end_lineno=54, end_col_offset=23), With( [ @@ -117,84 +570,84 @@ Module( Name( 'open', Load(), - lineno=15, + lineno=58, col_offset=8, - end_lineno=15, + end_lineno=58, end_col_offset=12), [ Attribute( Name( 'args', Load(), - lineno=15, + lineno=58, col_offset=13, - end_lineno=15, + end_lineno=58, end_col_offset=17), 'in_filename', Load(), - lineno=15, + lineno=58, col_offset=13, - end_lineno=15, + end_lineno=58, end_col_offset=29)], [], - lineno=15, + lineno=58, col_offset=8, - end_lineno=15, + end_lineno=58, end_col_offset=30), Name( 'in_file', Store(), - lineno=15, + lineno=58, col_offset=34, - end_lineno=15, + end_lineno=58, end_col_offset=41)), withitem( Call( Name( 'open', Load(), - lineno=16, + lineno=59, col_offset=8, - end_lineno=16, + end_lineno=59, end_col_offset=12), [ Attribute( Name( 'args', Load(), - lineno=16, + lineno=59, col_offset=13, - end_lineno=16, + end_lineno=59, end_col_offset=17), 'out_filename', Load(), - lineno=16, + lineno=59, col_offset=13, - end_lineno=16, + end_lineno=59, end_col_offset=30)], [ keyword( 'mode', Constant( 'wt', - lineno=16, + lineno=59, col_offset=37, - end_lineno=16, + end_lineno=59, end_col_offset=41), - lineno=16, + lineno=59, col_offset=32, - end_lineno=16, + end_lineno=59, end_col_offset=41)], - lineno=16, + lineno=59, col_offset=8, - end_lineno=16, + end_lineno=59, end_col_offset=42), Name( 'out_file', Store(), - lineno=16, + lineno=59, col_offset=46, - end_lineno=16, + end_lineno=59, end_col_offset=54))], [ Assign( @@ -202,56 +655,56 @@ Module( Name( 'records', Store(), - lineno=18, + lineno=61, col_offset=8, - end_lineno=18, + end_lineno=61, end_col_offset=15)], Call( Attribute( Name( 'json', Load(), - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=22), 'load', Load(), - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=27), [ Name( 'in_file', Load(), - lineno=18, + lineno=61, col_offset=28, - end_lineno=18, + end_lineno=61, end_col_offset=35)], [], - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=36), - lineno=18, + lineno=61, col_offset=8, - end_lineno=18, + end_lineno=61, end_col_offset=36), For( Name( 'record', Store(), - lineno=19, + lineno=62, col_offset=12, - end_lineno=19, + end_lineno=62, end_col_offset=18), Name( 'records', Load(), - lineno=19, + lineno=62, col_offset=22, - end_lineno=19, + end_lineno=62, end_col_offset=29), [ Expr( @@ -260,15 +713,15 @@ Module( Name( 'out_file', Load(), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=20), 'write', Load(), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=26), [ BinOp( @@ -277,62 +730,62 @@ Module( Name( 'json', Load(), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=31), 'dumps', Load(), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=37), [ Name( 'record', Load(), - lineno=20, + lineno=63, col_offset=38, - end_lineno=20, + end_lineno=63, end_col_offset=44)], [], - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=45), Add(), Constant( '\n', - lineno=20, + lineno=63, col_offset=48, - end_lineno=20, + end_lineno=63, end_col_offset=52), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=52)], [], - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=53), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=53)], [], - lineno=19, + lineno=62, col_offset=8, - end_lineno=20, + end_lineno=63, end_col_offset=53)], - lineno=14, + lineno=57, col_offset=4, - end_lineno=20, + end_lineno=63, end_col_offset=53)], [], - lineno=10, + lineno=53, col_offset=0, - end_lineno=20, + end_lineno=63, end_col_offset=53), FunctionDef( 'parse_args', @@ -348,27 +801,27 @@ Module( Name( 'parser', Store(), - lineno=24, + lineno=67, col_offset=4, - end_lineno=24, + end_lineno=67, end_col_offset=10)], Call( Name( 'ArgumentParser', Load(), - lineno=24, + lineno=67, col_offset=13, - end_lineno=24, + end_lineno=67, end_col_offset=27), [], [], - lineno=24, + lineno=67, col_offset=13, - end_lineno=24, + end_lineno=67, end_col_offset=29), - lineno=24, + lineno=67, col_offset=4, - end_lineno=24, + end_lineno=67, end_col_offset=29), Expr( Call( @@ -376,31 +829,31 @@ Module( Name( 'parser', Load(), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=10), 'add_argument', Load(), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=23), [ Constant( 'in_filename', - lineno=25, + lineno=68, col_offset=24, - end_lineno=25, + end_lineno=68, end_col_offset=37)], [], - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=38), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=38), Expr( Call( @@ -408,104 +861,104 @@ Module( Name( 'parser', Load(), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=10), 'add_argument', Load(), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=23), [ Constant( 'out_filename', - lineno=26, + lineno=69, col_offset=24, - end_lineno=26, + end_lineno=69, end_col_offset=38)], [], - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=39), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=39), Assign( [ Name( 'args', Store(), - lineno=27, + lineno=70, col_offset=4, - end_lineno=27, + end_lineno=70, end_col_offset=8)], Call( Attribute( Name( 'parser', Load(), - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=17), 'parse_args', Load(), - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=28), [], [], - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=30), - lineno=27, + lineno=70, col_offset=4, - end_lineno=27, + end_lineno=70, end_col_offset=30), Return( Name( 'args', Load(), - lineno=28, + lineno=71, col_offset=11, - end_lineno=28, + end_lineno=71, end_col_offset=15), - lineno=28, + lineno=71, col_offset=4, - end_lineno=28, + end_lineno=71, end_col_offset=15)], [], - lineno=23, + lineno=66, col_offset=0, - end_lineno=28, + end_lineno=71, end_col_offset=15), If( Compare( Name( '__name__', Load(), - lineno=30, + lineno=73, col_offset=3, - end_lineno=30, + end_lineno=73, end_col_offset=11), [ Eq()], [ Constant( '__main__', - lineno=30, + lineno=73, col_offset=15, - end_lineno=30, + end_lineno=73, end_col_offset=25)], - lineno=30, + lineno=73, col_offset=3, - end_lineno=30, + end_lineno=73, end_col_offset=25), [ Expr( @@ -513,490 +966,461 @@ Module( Name( 'main', Load(), - lineno=31, + lineno=74, col_offset=4, - end_lineno=31, + end_lineno=74, end_col_offset=8), [], [], - lineno=31, + lineno=74, col_offset=4, - end_lineno=31, + end_lineno=74, end_col_offset=10), - lineno=31, + lineno=74, col_offset=4, - end_lineno=31, - end_col_offset=10), - FunctionDef( - 'CtxManager', - arguments( - [], - [], - kwonlyargs=[], - kw_defaults=[], - defaults=[]), - [ - Pass( - lineno=40, - col_offset=22, - end_lineno=40, - end_col_offset=26)], - [], - lineno=40, - col_offset=4, - end_lineno=40, - end_col_offset=26), - FunctionDef( - 'CtxManager1', - arguments( - [], - [], - kwonlyargs=[], - kw_defaults=[], - defaults=[]), - [ - Pass( - lineno=41, - col_offset=23, - end_lineno=41, - end_col_offset=27)], - [], - lineno=41, - col_offset=4, - end_lineno=41, - end_col_offset=27), - FunctionDef( - 'CtxManager2', - arguments( - [], - [], - kwonlyargs=[], - kw_defaults=[], - defaults=[]), - [ - Pass( - lineno=42, - col_offset=23, - end_lineno=42, - end_col_offset=27)], - [], - lineno=42, - col_offset=4, - end_lineno=42, - end_col_offset=27), - FunctionDef( - 'CtxManager3', - arguments( - [], - [], - kwonlyargs=[], - kw_defaults=[], - defaults=[]), - [ - Pass( - lineno=43, - col_offset=23, - end_lineno=43, - end_col_offset=27)], - [], - lineno=43, - col_offset=4, - end_lineno=43, - end_col_offset=27), + end_lineno=74, + end_col_offset=10)], + [], + lineno=73, + col_offset=0, + end_lineno=74, + end_col_offset=10)], + []) +## END TREE BEFORE ## + +## BEGIN NORMALIZED TREE ## +Module( + [ + Expr( + Constant( + 'Calculate the fixed interest rate.', + lineno=6, + col_offset=0, + end_lineno=6, + end_col_offset=40), + lineno=6, + col_offset=0, + end_lineno=6, + end_col_offset=40), + ImportFrom( + 'decimal', + [ + alias( + 'ROUND_DOWN', + lineno=8, + col_offset=20, + end_lineno=8, + end_col_offset=30), + alias( + 'ROUND_UP', + lineno=8, + col_offset=32, + end_lineno=8, + end_col_offset=40), + alias( + 'Decimal', + lineno=8, + col_offset=42, + end_lineno=8, + end_col_offset=49), + alias( + 'localcontext', + lineno=8, + col_offset=51, + end_lineno=8, + end_col_offset=63)], + 0, + lineno=8, + col_offset=0, + end_lineno=8, + end_col_offset=63), + Import( + [ + alias( + 'pandas', + 'placeholder_0', + lineno=9, + col_offset=7, + end_lineno=9, + end_col_offset=19)], + lineno=9, + col_offset=0, + end_lineno=9, + end_col_offset=19), + FunctionDef( + 'placeholder_1', + arguments( + [], + [ + arg( + 'placeholder_2', + lineno=12, + col_offset=20, + end_lineno=12, + end_col_offset=41), + arg( + 'placeholder_3', + lineno=12, + col_offset=43, + end_lineno=12, + end_col_offset=69)], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + [ With( [ withitem( Call( Name( - 'CtxManager', + 'localcontext', Load(), - lineno=45, + lineno=30, col_offset=10, - end_lineno=45, - end_col_offset=20), + end_lineno=30, + end_col_offset=22), [], [], - lineno=45, + lineno=30, col_offset=10, - end_lineno=45, - end_col_offset=22), + end_lineno=30, + end_col_offset=24), Name( - 'example', + 'placeholder_4', Store(), - lineno=45, - col_offset=26, - end_lineno=45, - end_col_offset=33))], - [ - Expr( - Constant( - Ellipsis, - lineno=46, - col_offset=8, - end_lineno=46, - end_col_offset=11), - lineno=46, - col_offset=8, - end_lineno=46, - end_col_offset=11)], - lineno=45, - col_offset=4, - end_lineno=46, - end_col_offset=11), - With( - [ - withitem( - Call( - Name( - 'CtxManager1', - Load(), - lineno=49, - col_offset=8, - end_lineno=49, - end_col_offset=19), - [], - [], - lineno=49, - col_offset=8, - end_lineno=49, - end_col_offset=21)), + lineno=30, + col_offset=28, + end_lineno=30, + end_col_offset=36)), withitem( Call( Name( - 'CtxManager2', + 'localcontext', Load(), - lineno=50, - col_offset=8, - end_lineno=50, - end_col_offset=19), - [], - [], - lineno=50, - col_offset=8, - end_lineno=50, - end_col_offset=21))], - [ - Expr( - Constant( - Ellipsis, - lineno=52, - col_offset=8, - end_lineno=52, - end_col_offset=11), - lineno=52, - col_offset=8, - end_lineno=52, - end_col_offset=11)], - lineno=48, - col_offset=4, - end_lineno=52, - end_col_offset=11), - With( - [ - withitem( - Call( - Name( - 'CtxManager1', - Load(), - lineno=54, + lineno=31, col_offset=10, - end_lineno=54, - end_col_offset=21), + end_lineno=31, + end_col_offset=22), [], [], - lineno=54, + lineno=31, col_offset=10, - end_lineno=54, - end_col_offset=23), + end_lineno=31, + end_col_offset=24), Name( - 'example', + 'placeholder_5', Store(), - lineno=54, - col_offset=27, - end_lineno=54, - end_col_offset=34)), - withitem( - Call( - Name( - 'CtxManager2', - Load(), - lineno=55, - col_offset=8, - end_lineno=55, - end_col_offset=19), - [], - [], - lineno=55, - col_offset=8, - end_lineno=55, - end_col_offset=21))], + lineno=31, + col_offset=28, + end_lineno=31, + end_col_offset=36))], [ - Expr( - Constant( - Ellipsis, - lineno=56, - col_offset=8, - end_lineno=56, - end_col_offset=11), - lineno=56, - col_offset=8, - end_lineno=56, - end_col_offset=11)], - lineno=54, - col_offset=4, - end_lineno=56, - end_col_offset=11), - With( - [ - withitem( - Call( - Name( - 'CtxManager1', - Load(), - lineno=58, - col_offset=10, - end_lineno=58, - end_col_offset=21), - [], - [], - lineno=58, - col_offset=10, - end_lineno=58, - end_col_offset=23)), - withitem( - Call( - Name( - 'CtxManager2', - Load(), - lineno=59, + Assign( + [ + Attribute( + Name( + 'placeholder_4', + Load(), + lineno=32, + col_offset=8, + end_lineno=32, + end_col_offset=16), + 'placeholder_6', + Store(), + lineno=32, col_offset=8, - end_lineno=59, - end_col_offset=19), - [], - [], - lineno=59, - col_offset=8, - end_lineno=59, - end_col_offset=21), - Name( - 'example', - Store(), - lineno=59, - col_offset=25, - end_lineno=59, - end_col_offset=32))], - [ - Expr( + end_lineno=32, + end_col_offset=21)], Constant( - Ellipsis, - lineno=60, - col_offset=8, - end_lineno=60, - end_col_offset=11), - lineno=60, + 18, + lineno=32, + col_offset=24, + end_lineno=32, + end_col_offset=26), + lineno=32, col_offset=8, - end_lineno=60, - end_col_offset=11)], - lineno=58, - col_offset=4, - end_lineno=60, - end_col_offset=11), - With( - [ - withitem( - Call( - Name( - 'CtxManager1', - Load(), - lineno=63, + end_lineno=32, + end_col_offset=26), + Assign( + [ + Attribute( + Name( + 'placeholder_4', + Load(), + lineno=33, + col_offset=8, + end_lineno=33, + end_col_offset=16), + 'placeholder_7', + Store(), + lineno=33, col_offset=8, - end_lineno=63, - end_col_offset=19), - [], - [], - lineno=63, - col_offset=8, - end_lineno=63, - end_col_offset=21), + end_lineno=33, + end_col_offset=25)], Name( - 'example1', - Store(), - lineno=63, - col_offset=25, - end_lineno=63, - end_col_offset=33)), - withitem( - Call( - Name( - 'CtxManager2', - Load(), - lineno=64, + 'ROUND_UP', + Load(), + lineno=33, + col_offset=28, + end_lineno=33, + end_col_offset=36), + lineno=33, + col_offset=8, + end_lineno=33, + end_col_offset=36), + Assign( + [ + Attribute( + Name( + 'placeholder_5', + Load(), + lineno=35, + col_offset=8, + end_lineno=35, + end_col_offset=16), + 'placeholder_6', + Store(), + lineno=35, col_offset=8, - end_lineno=64, - end_col_offset=19), - [], - [], - lineno=64, - col_offset=8, - end_lineno=64, - end_col_offset=21), - Name( - 'example2', - Store(), - lineno=64, - col_offset=25, - end_lineno=64, - end_col_offset=33))], - [ - Expr( + end_lineno=35, + end_col_offset=21)], Constant( - Ellipsis, - lineno=66, - col_offset=8, - end_lineno=66, - end_col_offset=11), - lineno=66, + 12, + lineno=35, + col_offset=24, + end_lineno=35, + end_col_offset=26), + lineno=35, col_offset=8, - end_lineno=66, - end_col_offset=11)], - lineno=62, - col_offset=4, - end_lineno=66, - end_col_offset=11), - With( - [ - withitem( - Call( - Name( - 'CtxManager1', - Load(), - lineno=68, + end_lineno=35, + end_col_offset=26), + Assign( + [ + Attribute( + Name( + 'placeholder_5', + Load(), + lineno=36, + col_offset=8, + end_lineno=36, + end_col_offset=16), + 'placeholder_7', + Store(), + lineno=36, col_offset=8, - end_lineno=68, - end_col_offset=19), - [], - [], - lineno=68, - col_offset=8, - end_lineno=68, - end_col_offset=21), + end_lineno=36, + end_col_offset=25)], Name( - 'example1', - Store(), - lineno=68, - col_offset=25, - end_lineno=68, - end_col_offset=33)), - withitem( - Call( + 'ROUND_DOWN', + Load(), + lineno=36, + col_offset=28, + end_lineno=36, + end_col_offset=38), + lineno=36, + col_offset=8, + end_lineno=36, + end_col_offset=38), + Assign( + [ Name( - 'CtxManager2', - Load(), - lineno=69, + 'placeholder_8', + Store(), + lineno=38, col_offset=8, - end_lineno=69, - end_col_offset=19), - [], - [], - lineno=69, - col_offset=8, - end_lineno=69, - end_col_offset=21), - Name( - 'example2', - Store(), - lineno=69, - col_offset=25, - end_lineno=69, - end_col_offset=33)), - withitem( - Call( + end_lineno=38, + end_col_offset=23)], + BinOp( Name( - 'CtxManager3', + 'placeholder_3', Load(), - lineno=70, + lineno=38, + col_offset=26, + end_lineno=38, + end_col_offset=43), + Div(), + Call( + Name( + 'Decimal', + Load(), + lineno=38, + col_offset=46, + end_lineno=38, + end_col_offset=53), + [ + BinOp( + BinOp( + BinOp( + Constant( + 60, + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=56), + Mult(), + Constant( + 60, + lineno=38, + col_offset=59, + end_lineno=38, + end_col_offset=61), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=61), + Mult(), + Constant( + 24, + lineno=38, + col_offset=64, + end_lineno=38, + end_col_offset=66), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=66), + Mult(), + Constant( + 365, + lineno=38, + col_offset=69, + end_lineno=38, + end_col_offset=72), + lineno=38, + col_offset=54, + end_lineno=38, + end_col_offset=72)], + [], + lineno=38, + col_offset=46, + end_lineno=38, + end_col_offset=73), + lineno=38, + col_offset=26, + end_lineno=38, + end_col_offset=73), + lineno=38, + col_offset=8, + end_lineno=38, + end_col_offset=73), + Assign( + [ + Name( + 'placeholder_9', + Store(), + lineno=39, col_offset=8, - end_lineno=70, - end_col_offset=19), - [], - [], - lineno=70, - col_offset=8, - end_lineno=70, - end_col_offset=21), - Name( - 'example3', - Store(), - lineno=70, - col_offset=25, - end_lineno=70, - end_col_offset=33))], - [ - Expr( - Constant( - Ellipsis, - lineno=72, - col_offset=8, - end_lineno=72, - end_col_offset=11), - lineno=72, + end_lineno=39, + end_col_offset=18)], + BinOp( + BinOp( + Constant( + 1, + lineno=39, + col_offset=22, + end_lineno=39, + end_col_offset=23), + Sub(), + Name( + 'placeholder_2', + Load(), + lineno=39, + col_offset=26, + end_lineno=39, + end_col_offset=36), + lineno=39, + col_offset=22, + end_lineno=39, + end_col_offset=36), + Div(), + BinOp( + Name( + 'placeholder_2', + Load(), + lineno=39, + col_offset=41, + end_lineno=39, + end_col_offset=51), + Mult(), + Name( + 'placeholder_8', + Load(), + lineno=39, + col_offset=54, + end_lineno=39, + end_col_offset=69), + lineno=39, + col_offset=41, + end_lineno=39, + end_col_offset=69), + lineno=39, + col_offset=21, + end_lineno=39, + end_col_offset=70), + lineno=39, col_offset=8, - end_lineno=72, - end_col_offset=11)], - lineno=67, + end_lineno=39, + end_col_offset=70)], + lineno=30, col_offset=4, - end_lineno=72, - end_col_offset=11)], + end_lineno=39, + end_col_offset=70), + Return( + Name( + 'placeholder_9', + Load(), + lineno=40, + col_offset=11, + end_lineno=40, + end_col_offset=21), + lineno=40, + col_offset=4, + end_lineno=40, + end_col_offset=21)], [], - lineno=30, + lineno=12, col_offset=0, - end_lineno=72, - end_col_offset=11)], - []) -## END TREE BEFORE ## - -## BEGIN NORMALIZED TREE ## -Module( - [ + end_lineno=40, + end_col_offset=21), Expr( Constant( 'convert json to jsonl', - lineno=5, + lineno=48, col_offset=0, - end_lineno=5, + end_lineno=48, end_col_offset=27), - lineno=5, + lineno=48, col_offset=0, - end_lineno=5, + end_lineno=48, end_col_offset=27), ImportFrom( 'argparse', [ alias( 'ArgumentParser', - lineno=7, + lineno=50, col_offset=21, - end_lineno=7, + end_lineno=50, end_col_offset=35)], 0, - lineno=7, + lineno=50, col_offset=0, - end_lineno=7, + end_lineno=50, end_col_offset=35), Import( [ alias( 'json', - lineno=8, + lineno=51, col_offset=7, - end_lineno=8, + end_lineno=51, end_col_offset=11)], - lineno=8, + lineno=51, col_offset=0, - end_lineno=8, + end_lineno=51, end_col_offset=11), FunctionDef( - 'placeholder_0', + 'placeholder_10', arguments( [], [], @@ -1007,29 +1431,29 @@ Module( Assign( [ Name( - 'placeholder_1', + 'placeholder_11', Store(), - lineno=11, + lineno=54, col_offset=4, - end_lineno=11, + end_lineno=54, end_col_offset=8)], Call( Name( 'parse_args', Load(), - lineno=11, + lineno=54, col_offset=11, - end_lineno=11, + end_lineno=54, end_col_offset=21), [], [], - lineno=11, + lineno=54, col_offset=11, - end_lineno=11, + end_lineno=54, end_col_offset=23), - lineno=11, + lineno=54, col_offset=4, - end_lineno=11, + end_lineno=54, end_col_offset=23), With( [ @@ -1038,158 +1462,158 @@ Module( Name( 'open', Load(), - lineno=15, + lineno=58, col_offset=8, - end_lineno=15, + end_lineno=58, end_col_offset=12), [ Attribute( Name( - 'placeholder_1', + 'placeholder_11', Load(), - lineno=15, + lineno=58, col_offset=13, - end_lineno=15, + end_lineno=58, end_col_offset=17), 'in_filename', Load(), - lineno=15, + lineno=58, col_offset=13, - end_lineno=15, + end_lineno=58, end_col_offset=29)], [], - lineno=15, + lineno=58, col_offset=8, - end_lineno=15, + end_lineno=58, end_col_offset=30), Name( - 'placeholder_2', + 'placeholder_12', Store(), - lineno=15, + lineno=58, col_offset=34, - end_lineno=15, + end_lineno=58, end_col_offset=41)), withitem( Call( Name( 'open', Load(), - lineno=16, + lineno=59, col_offset=8, - end_lineno=16, + end_lineno=59, end_col_offset=12), [ Attribute( Name( - 'placeholder_1', + 'placeholder_11', Load(), - lineno=16, + lineno=59, col_offset=13, - end_lineno=16, + end_lineno=59, end_col_offset=17), 'out_filename', Load(), - lineno=16, + lineno=59, col_offset=13, - end_lineno=16, + end_lineno=59, end_col_offset=30)], [ keyword( - 'placeholder_3', + 'placeholder_13', Constant( 'wt', - lineno=16, + lineno=59, col_offset=37, - end_lineno=16, + end_lineno=59, end_col_offset=41), - lineno=16, + lineno=59, col_offset=32, - end_lineno=16, + end_lineno=59, end_col_offset=41)], - lineno=16, + lineno=59, col_offset=8, - end_lineno=16, + end_lineno=59, end_col_offset=42), Name( - 'placeholder_4', + 'placeholder_14', Store(), - lineno=16, + lineno=59, col_offset=46, - end_lineno=16, + end_lineno=59, end_col_offset=54))], [ Assign( [ Name( - 'placeholder_5', + 'placeholder_15', Store(), - lineno=18, + lineno=61, col_offset=8, - end_lineno=18, + end_lineno=61, end_col_offset=15)], Call( Attribute( Name( 'json', Load(), - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=22), 'load', Load(), - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=27), [ Name( - 'placeholder_2', + 'placeholder_12', Load(), - lineno=18, + lineno=61, col_offset=28, - end_lineno=18, + end_lineno=61, end_col_offset=35)], [], - lineno=18, + lineno=61, col_offset=18, - end_lineno=18, + end_lineno=61, end_col_offset=36), - lineno=18, + lineno=61, col_offset=8, - end_lineno=18, + end_lineno=61, end_col_offset=36), For( Name( - 'placeholder_6', + 'placeholder_16', Store(), - lineno=19, + lineno=62, col_offset=12, - end_lineno=19, + end_lineno=62, end_col_offset=18), Name( - 'placeholder_5', + 'placeholder_15', Load(), - lineno=19, + lineno=62, col_offset=22, - end_lineno=19, + end_lineno=62, end_col_offset=29), [ Expr( Call( Attribute( Name( - 'placeholder_4', + 'placeholder_14', Load(), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=20), 'write', Load(), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=26), [ BinOp( @@ -1198,65 +1622,65 @@ Module( Name( 'json', Load(), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=31), 'dumps', Load(), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=37), [ Name( - 'placeholder_6', + 'placeholder_16', Load(), - lineno=20, + lineno=63, col_offset=38, - end_lineno=20, + end_lineno=63, end_col_offset=44)], [], - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=45), Add(), Constant( '\n', - lineno=20, + lineno=63, col_offset=48, - end_lineno=20, + end_lineno=63, end_col_offset=52), - lineno=20, + lineno=63, col_offset=27, - end_lineno=20, + end_lineno=63, end_col_offset=52)], [], - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=53), - lineno=20, + lineno=63, col_offset=12, - end_lineno=20, + end_lineno=63, end_col_offset=53)], [], - lineno=19, + lineno=62, col_offset=8, - end_lineno=20, + end_lineno=63, end_col_offset=53)], - lineno=14, + lineno=57, col_offset=4, - end_lineno=20, + end_lineno=63, end_col_offset=53)], [], - lineno=10, + lineno=53, col_offset=0, - end_lineno=20, + end_lineno=63, end_col_offset=53), FunctionDef( - 'placeholder_7', + 'placeholder_17', arguments( [], [], @@ -1267,144 +1691,144 @@ Module( Assign( [ Name( - 'placeholder_8', + 'placeholder_18', Store(), - lineno=24, + lineno=67, col_offset=4, - end_lineno=24, + end_lineno=67, end_col_offset=10)], Call( Name( 'ArgumentParser', Load(), - lineno=24, + lineno=67, col_offset=13, - end_lineno=24, + end_lineno=67, end_col_offset=27), [], [], - lineno=24, + lineno=67, col_offset=13, - end_lineno=24, + end_lineno=67, end_col_offset=29), - lineno=24, + lineno=67, col_offset=4, - end_lineno=24, + end_lineno=67, end_col_offset=29), Expr( Call( Attribute( Name( - 'placeholder_8', + 'placeholder_18', Load(), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=10), 'add_argument', Load(), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=23), [ Constant( 'in_filename', - lineno=25, + lineno=68, col_offset=24, - end_lineno=25, + end_lineno=68, end_col_offset=37)], [], - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=38), - lineno=25, + lineno=68, col_offset=4, - end_lineno=25, + end_lineno=68, end_col_offset=38), Expr( Call( Attribute( Name( - 'placeholder_8', + 'placeholder_18', Load(), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=10), 'add_argument', Load(), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=23), [ Constant( 'out_filename', - lineno=26, + lineno=69, col_offset=24, - end_lineno=26, + end_lineno=69, end_col_offset=38)], [], - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=39), - lineno=26, + lineno=69, col_offset=4, - end_lineno=26, + end_lineno=69, end_col_offset=39), Assign( [ Name( - 'placeholder_1', + 'placeholder_11', Store(), - lineno=27, + lineno=70, col_offset=4, - end_lineno=27, + end_lineno=70, end_col_offset=8)], Call( Attribute( Name( - 'placeholder_8', + 'placeholder_18', Load(), - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=17), - 'placeholder_7', + 'placeholder_17', Load(), - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=28), [], [], - lineno=27, + lineno=70, col_offset=11, - end_lineno=27, + end_lineno=70, end_col_offset=30), - lineno=27, + lineno=70, col_offset=4, - end_lineno=27, + end_lineno=70, end_col_offset=30), Return( Name( - 'placeholder_1', + 'placeholder_11', Load(), - lineno=28, + lineno=71, col_offset=11, - end_lineno=28, + end_lineno=71, end_col_offset=15), - lineno=28, + lineno=71, col_offset=4, - end_lineno=28, + end_lineno=71, end_col_offset=15)], [], - lineno=23, + lineno=66, col_offset=0, - end_lineno=28, + end_lineno=71, end_col_offset=15)], []) ## END NORMALIZED TREE ## \ No newline at end of file diff --git a/test/example-parencontext-normalization/representation.txt b/test/example-parencontext-normalization/representation.txt index a540dba..c56b4e8 100644 --- a/test/example-parencontext-normalization/representation.txt +++ b/test/example-parencontext-normalization/representation.txt @@ -1 +1 @@ -Module([Expr(Constant('convert json to jsonl', lineno=5, col_offset=0, end_lineno=5, end_col_offset=27), lineno=5, col_offset=0, end_lineno=5, end_col_offset=27), ImportFrom('argparse', [alias('ArgumentParser', lineno=7, col_offset=21, end_lineno=7, end_col_offset=35)], 0, lineno=7, col_offset=0, end_lineno=7, end_col_offset=35), Import([alias('json', lineno=8, col_offset=7, end_lineno=8, end_col_offset=11)], lineno=8, col_offset=0, end_lineno=8, end_col_offset=11), FunctionDef('placeholder_0', arguments([], [], kwonlyargs=[], kw_defaults=[], defaults=[]), [Assign([Name('placeholder_1', Store(), lineno=11, col_offset=4, end_lineno=11, end_col_offset=8)], Call(Name('parse_args', Load(), lineno=11, col_offset=11, end_lineno=11, end_col_offset=21), [], [], lineno=11, col_offset=11, end_lineno=11, end_col_offset=23), lineno=11, col_offset=4, end_lineno=11, end_col_offset=23), With([withitem(Call(Name('open', Load(), lineno=15, col_offset=8, end_lineno=15, end_col_offset=12), [Attribute(Name('placeholder_1', Load(), lineno=15, col_offset=13, end_lineno=15, end_col_offset=17), 'in_filename', Load(), lineno=15, col_offset=13, end_lineno=15, end_col_offset=29)], [], lineno=15, col_offset=8, end_lineno=15, end_col_offset=30), Name('placeholder_2', Store(), lineno=15, col_offset=34, end_lineno=15, end_col_offset=41)), withitem(Call(Name('open', Load(), lineno=16, col_offset=8, end_lineno=16, end_col_offset=12), [Attribute(Name('placeholder_1', Load(), lineno=16, col_offset=13, end_lineno=16, end_col_offset=17), 'out_filename', Load(), lineno=16, col_offset=13, end_lineno=16, end_col_offset=30)], [keyword('placeholder_3', Constant('wt', lineno=16, col_offset=37, end_lineno=16, end_col_offset=41), lineno=16, col_offset=32, end_lineno=16, end_col_offset=41)], lineno=16, col_offset=8, end_lineno=16, end_col_offset=42), Name('placeholder_4', Store(), lineno=16, col_offset=46, end_lineno=16, end_col_offset=54))], [Assign([Name('placeholder_5', Store(), lineno=18, col_offset=8, end_lineno=18, end_col_offset=15)], Call(Attribute(Name('json', Load(), lineno=18, col_offset=18, end_lineno=18, end_col_offset=22), 'load', Load(), lineno=18, col_offset=18, end_lineno=18, end_col_offset=27), [Name('placeholder_2', Load(), lineno=18, col_offset=28, end_lineno=18, end_col_offset=35)], [], lineno=18, col_offset=18, end_lineno=18, end_col_offset=36), lineno=18, col_offset=8, end_lineno=18, end_col_offset=36), For(Name('placeholder_6', Store(), lineno=19, col_offset=12, end_lineno=19, end_col_offset=18), Name('placeholder_5', Load(), lineno=19, col_offset=22, end_lineno=19, end_col_offset=29), [Expr(Call(Attribute(Name('placeholder_4', Load(), lineno=20, col_offset=12, end_lineno=20, end_col_offset=20), 'write', Load(), lineno=20, col_offset=12, end_lineno=20, end_col_offset=26), [BinOp(Call(Attribute(Name('json', Load(), lineno=20, col_offset=27, end_lineno=20, end_col_offset=31), 'dumps', Load(), lineno=20, col_offset=27, end_lineno=20, end_col_offset=37), [Name('placeholder_6', Load(), lineno=20, col_offset=38, end_lineno=20, end_col_offset=44)], [], lineno=20, col_offset=27, end_lineno=20, end_col_offset=45), Add(), Constant('\n', lineno=20, col_offset=48, end_lineno=20, end_col_offset=52), lineno=20, col_offset=27, end_lineno=20, end_col_offset=52)], [], lineno=20, col_offset=12, end_lineno=20, end_col_offset=53), lineno=20, col_offset=12, end_lineno=20, end_col_offset=53)], [], lineno=19, col_offset=8, end_lineno=20, end_col_offset=53)], lineno=14, col_offset=4, end_lineno=20, end_col_offset=53)], [], lineno=10, col_offset=0, end_lineno=20, end_col_offset=53), FunctionDef('placeholder_7', arguments([], [], kwonlyargs=[], kw_defaults=[], defaults=[]), [Assign([Name('placeholder_8', Store(), lineno=24, col_offset=4, end_lineno=24, end_col_offset=10)], Call(Name('ArgumentParser', Load(), lineno=24, col_offset=13, end_lineno=24, end_col_offset=27), [], [], lineno=24, col_offset=13, end_lineno=24, end_col_offset=29), lineno=24, col_offset=4, end_lineno=24, end_col_offset=29), Expr(Call(Attribute(Name('placeholder_8', Load(), lineno=25, col_offset=4, end_lineno=25, end_col_offset=10), 'add_argument', Load(), lineno=25, col_offset=4, end_lineno=25, end_col_offset=23), [Constant('in_filename', lineno=25, col_offset=24, end_lineno=25, end_col_offset=37)], [], lineno=25, col_offset=4, end_lineno=25, end_col_offset=38), lineno=25, col_offset=4, end_lineno=25, end_col_offset=38), Expr(Call(Attribute(Name('placeholder_8', Load(), lineno=26, col_offset=4, end_lineno=26, end_col_offset=10), 'add_argument', Load(), lineno=26, col_offset=4, end_lineno=26, end_col_offset=23), [Constant('out_filename', lineno=26, col_offset=24, end_lineno=26, end_col_offset=38)], [], lineno=26, col_offset=4, end_lineno=26, end_col_offset=39), lineno=26, col_offset=4, end_lineno=26, end_col_offset=39), Assign([Name('placeholder_1', Store(), lineno=27, col_offset=4, end_lineno=27, end_col_offset=8)], Call(Attribute(Name('placeholder_8', Load(), lineno=27, col_offset=11, end_lineno=27, end_col_offset=17), 'placeholder_7', Load(), lineno=27, col_offset=11, end_lineno=27, end_col_offset=28), [], [], lineno=27, col_offset=11, end_lineno=27, end_col_offset=30), lineno=27, col_offset=4, end_lineno=27, end_col_offset=30), Return(Name('placeholder_1', Load(), lineno=28, col_offset=11, end_lineno=28, end_col_offset=15), lineno=28, col_offset=4, end_lineno=28, end_col_offset=15)], [], lineno=23, col_offset=0, end_lineno=28, end_col_offset=15)], []) \ No newline at end of file +Module([Expr(Constant('Calculate the fixed interest rate.', lineno=6, col_offset=0, end_lineno=6, end_col_offset=40), lineno=6, col_offset=0, end_lineno=6, end_col_offset=40), ImportFrom('decimal', [alias('ROUND_DOWN', lineno=8, col_offset=20, end_lineno=8, end_col_offset=30), alias('ROUND_UP', lineno=8, col_offset=32, end_lineno=8, end_col_offset=40), alias('Decimal', lineno=8, col_offset=42, end_lineno=8, end_col_offset=49), alias('localcontext', lineno=8, col_offset=51, end_lineno=8, end_col_offset=63)], 0, lineno=8, col_offset=0, end_lineno=8, end_col_offset=63), Import([alias('pandas', 'placeholder_0', lineno=9, col_offset=7, end_lineno=9, end_col_offset=19)], lineno=9, col_offset=0, end_lineno=9, end_col_offset=19), FunctionDef('placeholder_1', arguments([], [arg('placeholder_2', lineno=12, col_offset=20, end_lineno=12, end_col_offset=41), arg('placeholder_3', lineno=12, col_offset=43, end_lineno=12, end_col_offset=69)], kwonlyargs=[], kw_defaults=[], defaults=[]), [With([withitem(Call(Name('localcontext', Load(), lineno=30, col_offset=10, end_lineno=30, end_col_offset=22), [], [], lineno=30, col_offset=10, end_lineno=30, end_col_offset=24), Name('placeholder_4', Store(), lineno=30, col_offset=28, end_lineno=30, end_col_offset=36)), withitem(Call(Name('localcontext', Load(), lineno=31, col_offset=10, end_lineno=31, end_col_offset=22), [], [], lineno=31, col_offset=10, end_lineno=31, end_col_offset=24), Name('placeholder_5', Store(), lineno=31, col_offset=28, end_lineno=31, end_col_offset=36))], [Assign([Attribute(Name('placeholder_4', Load(), lineno=32, col_offset=8, end_lineno=32, end_col_offset=16), 'placeholder_6', Store(), lineno=32, col_offset=8, end_lineno=32, end_col_offset=21)], Constant(18, lineno=32, col_offset=24, end_lineno=32, end_col_offset=26), lineno=32, col_offset=8, end_lineno=32, end_col_offset=26), Assign([Attribute(Name('placeholder_4', Load(), lineno=33, col_offset=8, end_lineno=33, end_col_offset=16), 'placeholder_7', Store(), lineno=33, col_offset=8, end_lineno=33, end_col_offset=25)], Name('ROUND_UP', Load(), lineno=33, col_offset=28, end_lineno=33, end_col_offset=36), lineno=33, col_offset=8, end_lineno=33, end_col_offset=36), Assign([Attribute(Name('placeholder_5', Load(), lineno=35, col_offset=8, end_lineno=35, end_col_offset=16), 'placeholder_6', Store(), lineno=35, col_offset=8, end_lineno=35, end_col_offset=21)], Constant(12, lineno=35, col_offset=24, end_lineno=35, end_col_offset=26), lineno=35, col_offset=8, end_lineno=35, end_col_offset=26), Assign([Attribute(Name('placeholder_5', Load(), lineno=36, col_offset=8, end_lineno=36, end_col_offset=16), 'placeholder_7', Store(), lineno=36, col_offset=8, end_lineno=36, end_col_offset=25)], Name('ROUND_DOWN', Load(), lineno=36, col_offset=28, end_lineno=36, end_col_offset=38), lineno=36, col_offset=8, end_lineno=36, end_col_offset=38), Assign([Name('placeholder_8', Store(), lineno=38, col_offset=8, end_lineno=38, end_col_offset=23)], BinOp(Name('placeholder_3', Load(), lineno=38, col_offset=26, end_lineno=38, end_col_offset=43), Div(), Call(Name('Decimal', Load(), lineno=38, col_offset=46, end_lineno=38, end_col_offset=53), [BinOp(BinOp(BinOp(Constant(60, lineno=38, col_offset=54, end_lineno=38, end_col_offset=56), Mult(), Constant(60, lineno=38, col_offset=59, end_lineno=38, end_col_offset=61), lineno=38, col_offset=54, end_lineno=38, end_col_offset=61), Mult(), Constant(24, lineno=38, col_offset=64, end_lineno=38, end_col_offset=66), lineno=38, col_offset=54, end_lineno=38, end_col_offset=66), Mult(), Constant(365, lineno=38, col_offset=69, end_lineno=38, end_col_offset=72), lineno=38, col_offset=54, end_lineno=38, end_col_offset=72)], [], lineno=38, col_offset=46, end_lineno=38, end_col_offset=73), lineno=38, col_offset=26, end_lineno=38, end_col_offset=73), lineno=38, col_offset=8, end_lineno=38, end_col_offset=73), Assign([Name('placeholder_9', Store(), lineno=39, col_offset=8, end_lineno=39, end_col_offset=18)], BinOp(BinOp(Constant(1, lineno=39, col_offset=22, end_lineno=39, end_col_offset=23), Sub(), Name('placeholder_2', Load(), lineno=39, col_offset=26, end_lineno=39, end_col_offset=36), lineno=39, col_offset=22, end_lineno=39, end_col_offset=36), Div(), BinOp(Name('placeholder_2', Load(), lineno=39, col_offset=41, end_lineno=39, end_col_offset=51), Mult(), Name('placeholder_8', Load(), lineno=39, col_offset=54, end_lineno=39, end_col_offset=69), lineno=39, col_offset=41, end_lineno=39, end_col_offset=69), lineno=39, col_offset=21, end_lineno=39, end_col_offset=70), lineno=39, col_offset=8, end_lineno=39, end_col_offset=70)], lineno=30, col_offset=4, end_lineno=39, end_col_offset=70), Return(Name('placeholder_9', Load(), lineno=40, col_offset=11, end_lineno=40, end_col_offset=21), lineno=40, col_offset=4, end_lineno=40, end_col_offset=21)], [], lineno=12, col_offset=0, end_lineno=40, end_col_offset=21), Expr(Constant('convert json to jsonl', lineno=48, col_offset=0, end_lineno=48, end_col_offset=27), lineno=48, col_offset=0, end_lineno=48, end_col_offset=27), ImportFrom('argparse', [alias('ArgumentParser', lineno=50, col_offset=21, end_lineno=50, end_col_offset=35)], 0, lineno=50, col_offset=0, end_lineno=50, end_col_offset=35), Import([alias('json', lineno=51, col_offset=7, end_lineno=51, end_col_offset=11)], lineno=51, col_offset=0, end_lineno=51, end_col_offset=11), FunctionDef('placeholder_10', arguments([], [], kwonlyargs=[], kw_defaults=[], defaults=[]), [Assign([Name('placeholder_11', Store(), lineno=54, col_offset=4, end_lineno=54, end_col_offset=8)], Call(Name('parse_args', Load(), lineno=54, col_offset=11, end_lineno=54, end_col_offset=21), [], [], lineno=54, col_offset=11, end_lineno=54, end_col_offset=23), lineno=54, col_offset=4, end_lineno=54, end_col_offset=23), With([withitem(Call(Name('open', Load(), lineno=58, col_offset=8, end_lineno=58, end_col_offset=12), [Attribute(Name('placeholder_11', Load(), lineno=58, col_offset=13, end_lineno=58, end_col_offset=17), 'in_filename', Load(), lineno=58, col_offset=13, end_lineno=58, end_col_offset=29)], [], lineno=58, col_offset=8, end_lineno=58, end_col_offset=30), Name('placeholder_12', Store(), lineno=58, col_offset=34, end_lineno=58, end_col_offset=41)), withitem(Call(Name('open', Load(), lineno=59, col_offset=8, end_lineno=59, end_col_offset=12), [Attribute(Name('placeholder_11', Load(), lineno=59, col_offset=13, end_lineno=59, end_col_offset=17), 'out_filename', Load(), lineno=59, col_offset=13, end_lineno=59, end_col_offset=30)], [keyword('placeholder_13', Constant('wt', lineno=59, col_offset=37, end_lineno=59, end_col_offset=41), lineno=59, col_offset=32, end_lineno=59, end_col_offset=41)], lineno=59, col_offset=8, end_lineno=59, end_col_offset=42), Name('placeholder_14', Store(), lineno=59, col_offset=46, end_lineno=59, end_col_offset=54))], [Assign([Name('placeholder_15', Store(), lineno=61, col_offset=8, end_lineno=61, end_col_offset=15)], Call(Attribute(Name('json', Load(), lineno=61, col_offset=18, end_lineno=61, end_col_offset=22), 'load', Load(), lineno=61, col_offset=18, end_lineno=61, end_col_offset=27), [Name('placeholder_12', Load(), lineno=61, col_offset=28, end_lineno=61, end_col_offset=35)], [], lineno=61, col_offset=18, end_lineno=61, end_col_offset=36), lineno=61, col_offset=8, end_lineno=61, end_col_offset=36), For(Name('placeholder_16', Store(), lineno=62, col_offset=12, end_lineno=62, end_col_offset=18), Name('placeholder_15', Load(), lineno=62, col_offset=22, end_lineno=62, end_col_offset=29), [Expr(Call(Attribute(Name('placeholder_14', Load(), lineno=63, col_offset=12, end_lineno=63, end_col_offset=20), 'write', Load(), lineno=63, col_offset=12, end_lineno=63, end_col_offset=26), [BinOp(Call(Attribute(Name('json', Load(), lineno=63, col_offset=27, end_lineno=63, end_col_offset=31), 'dumps', Load(), lineno=63, col_offset=27, end_lineno=63, end_col_offset=37), [Name('placeholder_16', Load(), lineno=63, col_offset=38, end_lineno=63, end_col_offset=44)], [], lineno=63, col_offset=27, end_lineno=63, end_col_offset=45), Add(), Constant('\n', lineno=63, col_offset=48, end_lineno=63, end_col_offset=52), lineno=63, col_offset=27, end_lineno=63, end_col_offset=52)], [], lineno=63, col_offset=12, end_lineno=63, end_col_offset=53), lineno=63, col_offset=12, end_lineno=63, end_col_offset=53)], [], lineno=62, col_offset=8, end_lineno=63, end_col_offset=53)], lineno=57, col_offset=4, end_lineno=63, end_col_offset=53)], [], lineno=53, col_offset=0, end_lineno=63, end_col_offset=53), FunctionDef('placeholder_17', arguments([], [], kwonlyargs=[], kw_defaults=[], defaults=[]), [Assign([Name('placeholder_18', Store(), lineno=67, col_offset=4, end_lineno=67, end_col_offset=10)], Call(Name('ArgumentParser', Load(), lineno=67, col_offset=13, end_lineno=67, end_col_offset=27), [], [], lineno=67, col_offset=13, end_lineno=67, end_col_offset=29), lineno=67, col_offset=4, end_lineno=67, end_col_offset=29), Expr(Call(Attribute(Name('placeholder_18', Load(), lineno=68, col_offset=4, end_lineno=68, end_col_offset=10), 'add_argument', Load(), lineno=68, col_offset=4, end_lineno=68, end_col_offset=23), [Constant('in_filename', lineno=68, col_offset=24, end_lineno=68, end_col_offset=37)], [], lineno=68, col_offset=4, end_lineno=68, end_col_offset=38), lineno=68, col_offset=4, end_lineno=68, end_col_offset=38), Expr(Call(Attribute(Name('placeholder_18', Load(), lineno=69, col_offset=4, end_lineno=69, end_col_offset=10), 'add_argument', Load(), lineno=69, col_offset=4, end_lineno=69, end_col_offset=23), [Constant('out_filename', lineno=69, col_offset=24, end_lineno=69, end_col_offset=38)], [], lineno=69, col_offset=4, end_lineno=69, end_col_offset=39), lineno=69, col_offset=4, end_lineno=69, end_col_offset=39), Assign([Name('placeholder_11', Store(), lineno=70, col_offset=4, end_lineno=70, end_col_offset=8)], Call(Attribute(Name('placeholder_18', Load(), lineno=70, col_offset=11, end_lineno=70, end_col_offset=17), 'placeholder_17', Load(), lineno=70, col_offset=11, end_lineno=70, end_col_offset=28), [], [], lineno=70, col_offset=11, end_lineno=70, end_col_offset=30), lineno=70, col_offset=4, end_lineno=70, end_col_offset=30), Return(Name('placeholder_11', Load(), lineno=71, col_offset=11, end_lineno=71, end_col_offset=15), lineno=71, col_offset=4, end_lineno=71, end_col_offset=15)], [], lineno=66, col_offset=0, end_lineno=71, end_col_offset=15)], []) \ No newline at end of file