@@ -121,7 +121,9 @@ def measure_sizes():
121
121
_changed_version_size = - 1
122
122
_changed_version_strings_size = - 1
123
123
124
- PERCENT_DIFF_FLAG_VALUE = 5.0 # percent change from current version to trigger comment
124
+ PERCENT_DIFF_FLAG_VALUE = (
125
+ 5.0 # percent change from current version to trigger comment
126
+ )
125
127
BASELINE_FLAG_VALUE = 1500 # bytes or larger to trigger comment
126
128
PERCENT_STRINGS_FLAG_VALUE = 50 # percent of mpy file(s) to trigger comment
127
129
@@ -150,10 +152,14 @@ def measure_sizes():
150
152
os .system (f"strings { mpy_file } > strings_output.txt" )
151
153
string_file_stats = os .stat ("strings_output.txt" )
152
154
_changed_version_strings_size = string_file_stats .st_size
153
- _changed_version_strings_percentage = (string_file_stats .st_size / file_stats .st_size ) * 100.0
155
+ _changed_version_strings_percentage = (
156
+ string_file_stats .st_size / file_stats .st_size
157
+ ) * 100.0
154
158
output_str += f"strings output size: { _changed_version_strings_size } bytes\n "
155
- output_str += f"strings percentage of mpy: " \
156
- f"{ _changed_version_strings_percentage :.2f} %\n "
159
+ output_str += (
160
+ f"strings percentage of mpy: "
161
+ f"{ _changed_version_strings_percentage :.2f} %\n "
162
+ )
157
163
158
164
else :
159
165
os .chdir (os .listdir ("./" )[0 ])
@@ -185,10 +191,13 @@ def measure_sizes():
185
191
_cur_version_size = file_stats .st_size
186
192
os .system (f"strings { mpy_file } > strings_output.txt" )
187
193
string_file_stats = os .stat ("strings_output.txt" )
188
- _cur_version_strings_percentage = (string_file_stats .st_size / file_stats .st_size ) * 100.0
194
+ _cur_version_strings_percentage = (
195
+ string_file_stats .st_size / file_stats .st_size
196
+ ) * 100.0
189
197
output_str += f"strings output size: { string_file_stats .st_size } bytes\n "
190
- output_str += f"strings percentage of mpy: " \
191
- f"{ _cur_version_strings_percentage :.2f} %\n "
198
+ output_str += (
199
+ f"strings percentage of mpy: " f"{ _cur_version_strings_percentage :.2f} %\n "
200
+ )
192
201
_cur_version_strings_size = string_file_stats .st_size
193
202
194
203
else :
@@ -201,7 +210,9 @@ def measure_sizes():
201
210
output_str += f"total mpy files size: { file_size } bytes\n "
202
211
output_str += f"strings output size: { strings_size } bytes\n "
203
212
if file_size != 0 :
204
- output_str += f"strings percentage of mpy: { _cur_version_strings_percentage :.2f} %\n "
213
+ output_str += (
214
+ f"strings percentage of mpy: { _cur_version_strings_percentage :.2f} %\n "
215
+ )
205
216
206
217
"""
207
218
output_str += "\n ---\n \n "
@@ -239,9 +250,11 @@ def measure_sizes():
239
250
240
251
output_str += "\n ---\n \n "
241
252
output_str += "Summary:\n "
242
- output_str += f"Mpy File Size Difference: { _changed_version_size - _cur_version_size } \n "
253
+ output_str += (
254
+ f"Mpy File Size Difference: { _changed_version_size - _cur_version_size } \n "
255
+ )
243
256
output_str += f"Mpy Strings Size Difference: { _changed_version_strings_size - _cur_version_strings_size } \n "
244
- output_str += f"Mpy Strings Percentage Difference: { _changed_version_strings_percentage - _cur_version_strings_percentage } \n "
257
+ output_str += f"Mpy Strings Percentage Difference: { _changed_version_strings_percentage - _cur_version_strings_percentage :.2f } % \n "
245
258
246
259
_is_changed_from_current = False
247
260
_is_above_baseline = False
@@ -251,7 +264,9 @@ def measure_sizes():
251
264
if _changed_version_size > BASELINE_FLAG_VALUE :
252
265
_is_above_baseline = True
253
266
254
- _changed_version_strings_percent = (_changed_version_strings_size / _changed_version_size ) * 100.0
267
+ _changed_version_strings_percent = (
268
+ _changed_version_strings_size / _changed_version_size
269
+ ) * 100.0
255
270
# print(f"{_changed_version_strings_percent} > {PERCENT_STRINGS_FLAG_VALUE}")
256
271
if _changed_version_strings_percent > PERCENT_STRINGS_FLAG_VALUE :
257
272
_is_over_string_percentage = True
0 commit comments