Skip to content

Commit

Permalink
Cleaned up node definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mad-cat-lon committed Aug 7, 2024
1 parent bbcb15f commit 68b1891
Showing 1 changed file with 17 additions and 126 deletions.
143 changes: 17 additions & 126 deletions jargonaut/transformations/data/utf8_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,18 @@ def leave_SimpleString(
value=cst.Integer(
value=encoded_string,
lpar=[
cst.LeftParen(
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
cst.LeftParen(),
],
rpar=[
cst.RightParen(
whitespace_before=cst.SimpleWhitespace(
value='',
),
),
cst.RightParen(),
],
),
attr=cst.Name(
value='to_bytes',
lpar=[],
rpar=[],
),
dot=cst.Dot(
whitespace_before=cst.SimpleWhitespace(
value='',
),
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
dot=cst.Dot(),
lpar=[],
rpar=[],
),
Expand All @@ -86,82 +71,40 @@ def leave_SimpleString(
value=cst.Integer(
value=encoded_string,
lpar=[
cst.LeftParen(
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
cst.LeftParen(),
],
rpar=[
cst.RightParen(
whitespace_before=cst.SimpleWhitespace(
value='',
),
),
cst.RightParen(),
],
),
attr=cst.Name(
value='bit_length',
lpar=[],
rpar=[],
),
dot=cst.Dot(
whitespace_before=cst.SimpleWhitespace(
value='',
),
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
dot=cst.Dot(),
lpar=[],
rpar=[],
),
args=[],
lpar=[],
rpar=[],
whitespace_after_func=cst.SimpleWhitespace(
value='',
),
whitespace_before_args=cst.SimpleWhitespace(
value='',
),
),
operator=cst.Add(
whitespace_before=cst.SimpleWhitespace(
value=' ',
),
whitespace_after=cst.SimpleWhitespace(
value=' ',
),
),
right=cst.Integer(
value='7',
lpar=[],
rpar=[],
),
lpar=[
cst.LeftParen(
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
cst.LeftParen(),
],
rpar=[
cst.RightParen(
whitespace_before=cst.SimpleWhitespace(
value='',
),
),
cst.RightParen(),
],
),
operator=cst.FloorDivide(
whitespace_before=cst.SimpleWhitespace(
value=' ',
),
whitespace_after=cst.SimpleWhitespace(
value=' ',
),
),
operator=cst.FloorDivide(),
right=cst.Integer(
value='8',
lpar=[],
Expand All @@ -172,21 +115,8 @@ def leave_SimpleString(
),
keyword=None,
equal=cst.MaybeSentinel.DEFAULT,
comma=cst.Comma(
whitespace_before=cst.SimpleWhitespace(
value='',
),
whitespace_after=cst.SimpleWhitespace(
value=' ',
),
),
star='',
whitespace_after_star=cst.SimpleWhitespace(
value='',
),
whitespace_after_arg=cst.SimpleWhitespace(
value='',
),
comma=cst.Comma(),
star=''
),
cst.Arg(
value=cst.SimpleString(
Expand All @@ -197,34 +127,18 @@ def leave_SimpleString(
keyword=None,
equal=cst.MaybeSentinel.DEFAULT,
comma=cst.MaybeSentinel.DEFAULT,
star='',
whitespace_after_star=cst.SimpleWhitespace(
value='',
),
whitespace_after_arg=cst.SimpleWhitespace(
value='',
),
star=''
),
],
lpar=[],
rpar=[],
whitespace_after_func=cst.SimpleWhitespace(
value='',
),
whitespace_before_args=cst.SimpleWhitespace(
value='',
),
),
slice=[
cst.SubscriptElement(
slice=cst.Slice(
lower=None,
upper=cst.UnaryOperation(
operator=cst.Minus(
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
operator=cst.Minus(),
expression=cst.Integer(
value='1',
lpar=[],
Expand All @@ -234,34 +148,17 @@ def leave_SimpleString(
rpar=[],
),
step=None,
first_colon=cst.Colon(
whitespace_before=cst.SimpleWhitespace(
value='',
),
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
first_colon=cst.Colon(),
second_colon=cst.MaybeSentinel.DEFAULT,
),
comma=cst.MaybeSentinel.DEFAULT,
),
],
lbracket=cst.LeftSquareBracket(
whitespace_after=cst.SimpleWhitespace(
value='',
),
),
rbracket=cst.RightSquareBracket(
whitespace_before=cst.SimpleWhitespace(
value='',
),
),
lbracket=cst.LeftSquareBracket(),
rbracket=cst.RightSquareBracket(),
lpar=[],
rpar=[],
whitespace_after_value=cst.SimpleWhitespace(
value='',
),

),
attr=cst.Name(
value='decode',
Expand Down Expand Up @@ -300,12 +197,6 @@ def leave_SimpleString(
],
lpar=[],
rpar=[],
whitespace_after_func=cst.SimpleWhitespace(
value='',
),
whitespace_before_args=cst.SimpleWhitespace(
value='',
),
)
return new_node
else:
Expand Down

0 comments on commit 68b1891

Please sign in to comment.