Make mypy happy

master
Salvo 'LtWorf' Tomaselli 2020-08-12 10:52:11 +07:00
parent f21a7beb41
commit 40a15178fe
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 2 additions and 7 deletions

@ -72,24 +72,19 @@ def optimize_all(expression: Union[str, Node], rels: Dict[str, Relation], specif
else: else:
raise (TypeError("expression must be a string or a node")) raise (TypeError("expression must be a string or a node"))
if isinstance(debug, list):
dbg = True
else:
dbg = False
total = 1 total = 1
while total != 0: while total != 0:
total = 0 total = 0
if specific: if specific:
for i in optimizations.specific_optimizations: for i in optimizations.specific_optimizations:
n, c = recursive_scan(i, n, rels) n, c = recursive_scan(i, n, rels)
if c != 0 and dbg: if c != 0 and isinstance(debug, list):
debug.append(str(n)) debug.append(str(n))
total += c total += c
if general: if general:
for i in optimizations.general_optimizations: for i in optimizations.general_optimizations:
n, c = recursive_scan(i, n, None) n, c = recursive_scan(i, n, None)
if c != 0 and dbg: if c != 0 and isinstance(debug, list):
debug.append(str(n)) debug.append(str(n))
total += c total += c
if tostr: if tostr: