|
1 | 1 | from argparse import ArgumentParser |
2 | 2 | from os import path |
3 | 3 | from shutil import copyfile |
| 4 | + |
4 | 5 | from kopyt import Parser |
5 | 6 | from kopyt.node import ( |
| 7 | + CallSuffix, |
6 | 8 | ImportHeader, |
| 9 | + LineStringLiteral, |
7 | 10 | PostfixUnaryExpression, |
8 | 11 | SimpleIdentifier, |
9 | | - CallSuffix, |
10 | 12 | ValueArgument, |
11 | | - LineStringLiteral, |
12 | 13 | ) |
13 | 14 | from kopyt.position import Position |
14 | 15 |
|
|
55 | 56 | if root_statement.statement.expression.value == "android": |
56 | 57 | for android_suffixe in root_statement.statement.suffixes: |
57 | 58 | if isinstance(android_suffixe, CallSuffix): |
58 | | - if android_suffixe.lambda_expression != None: |
| 59 | + if android_suffixe.lambda_expression is not None: |
59 | 60 | android_suffixe.lambda_expression.value.statements = [ |
60 | 61 | Parser(signing_configs_code).parse_statement() |
61 | 62 | ] + list(android_suffixe.lambda_expression.value.statements) |
|
81 | 82 | ): |
82 | 83 | if ( |
83 | 84 | buildtypes_suffixe.lambda_expression |
84 | | - != None |
| 85 | + is not None |
85 | 86 | ): |
86 | | - for ( |
87 | | - buildtypes_statement |
88 | | - ) in ( |
89 | | - buildtypes_suffixe.lambda_expression.value.statements |
90 | | - ): |
| 87 | + for buildtypes_statement in buildtypes_suffixe.lambda_expression.value.statements: |
91 | 88 | if isinstance( |
92 | 89 | buildtypes_statement.statement, |
93 | 90 | PostfixUnaryExpression, |
|
100 | 97 | buildtypes_statement.statement.expression.value |
101 | 98 | == "getByName" |
102 | 99 | ): |
103 | | - for getbyname_suffixe in ( |
104 | | - buildtypes_statement.statement.suffixes |
105 | | - ): |
| 100 | + for getbyname_suffixe in buildtypes_statement.statement.suffixes: |
106 | 101 | if isinstance( |
107 | 102 | getbyname_suffixe, |
108 | 103 | CallSuffix, |
109 | 104 | ): |
110 | 105 | if ( |
111 | 106 | getbyname_suffixe.arguments |
112 | | - != None |
| 107 | + is not None |
113 | 108 | ): |
114 | | - for getbyname_suffixe_argument in ( |
115 | | - getbyname_suffixe.arguments |
116 | | - ): |
| 109 | + for getbyname_suffixe_argument in getbyname_suffixe.arguments: |
117 | 110 | if isinstance( |
118 | 111 | getbyname_suffixe_argument, |
119 | 112 | ValueArgument, |
|
128 | 121 | ): |
129 | 122 | if ( |
130 | 123 | getbyname_suffixe.lambda_expression |
131 | | - != None |
| 124 | + is not None |
132 | 125 | ): |
133 | | - getbyname_suffixe.lambda_expression.value.statements = list( |
134 | | - getbyname_suffixe.lambda_expression.value.statements |
135 | | - ) + [ |
136 | | - Parser( |
137 | | - use_signing_configs_code |
138 | | - ).parse_statement() |
139 | | - ] |
| 126 | + getbyname_suffixe.lambda_expression.value.statements = ( |
| 127 | + list( |
| 128 | + getbyname_suffixe.lambda_expression.value.statements |
| 129 | + ) |
| 130 | + + [ |
| 131 | + Parser( |
| 132 | + use_signing_configs_code |
| 133 | + ).parse_statement() |
| 134 | + ] |
| 135 | + ) |
140 | 136 | gradle_build_script_file.seek(0) |
141 | 137 | gradle_build_script_file.truncate() |
142 | 138 | gradle_build_script_file.write(gradle_build_script.__str__()) |
|
0 commit comments