Fixed translations + Resizing line overlap + Disabled No type + Reorganized settings + Other fixes

This commit is contained in:
2024-07-25 09:29:10 +02:00
parent adff072475
commit ac733092cc
9 changed files with 354 additions and 282 deletions
+48 -5
View File
@@ -31,6 +31,42 @@ def get_locale():
return DEFAULT_LANGUAGE
def ilog(n, base):
"""
Find the integer log of n with respect to the base.
>>> import math
>>> for base in range(2, 16 + 1):
... for n in range(1, 1000):
... assert ilog(n, base) == int(math.log(n, base) + 1e-10), '%s %s' % (n, base)
"""
count = 0
while n >= base:
count += 1
n //= base
return count
def sci_notation(n, prec=2):
"""
Represent n in scientific notation, with the specified precision.
>>> sci_notation(1234 * 10**1000)
'1.234e+1003'
>>> sci_notation(10**1000 // 2, prec=1)
'5.0e+999'
"""
if -100000 < n < 100000:
return str(n)
if n < 0:
return "-" + sci_notation(-n, prec=prec)
base = 10
exponent = ilog(n, base)
mantissa = n / base**exponent
return '{0:.{1}f}e{2:+d}'.format(mantissa, prec, exponent)
def create_app():
app = Flask(__name__, static_url_path='/stark/static')
@@ -50,7 +86,7 @@ def create_app():
# mandatory parameters with default value
configs['internal_saves'] = './internal_saves'
configs['cpu_cores'] = 12
configs['cpu_cores'] = 1
configs['complete_tree_type'] = True
configs['dependency_type'] = True
configs['node_order'] = True
@@ -150,12 +186,19 @@ def create_app():
for j, v in enumerate(row):
content_dict[head[j]].append(v)
displayed_head = [v for k, v in table_columns2displayed_table_columns.items() if k in head]
head = [(k, v) for k, v in table_columns2displayed_table_columns.items() if k in head]
displayed_content_dict = {}
for h in displayed_head:
displayed_content_dict[h] = content_dict[displayed_table_columns2table_columns[h]]
for f_h, h in head:
if f_h == '%DIFF' or f_h == 'OR':
# for num_str in content_dict[displayed_table_columns2table_columns[h]]:
# if n < 0:
# return "-" + sci_notation(-n, prec=prec)
# sci_notation(eval(num))
displayed_content_dict[f_h] = [sci_notation(eval(n)) for n in content_dict[displayed_table_columns2table_columns[h]]]
else:
displayed_content_dict[f_h] = content_dict[displayed_table_columns2table_columns[h]]
return render_template('result.html', head_row=displayed_head, content=displayed_content_dict)
return render_template('result.html', head=head, content=displayed_content_dict)
@app.route('/stark/', methods=['GET', 'POST'])
# @headers({'Cache-Control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'})