fixed bool ops to be in spec
Took 53 minutes
This commit is contained in:
parent
fb36aef06e
commit
09010a4789
1 changed files with 9 additions and 3 deletions
|
@ -60,8 +60,8 @@ class AstGenerator:
|
||||||
|
|
||||||
self.bool_op_options, self.bool_op_cutoffs, self.bool_op_numline = (
|
self.bool_op_options, self.bool_op_cutoffs, self.bool_op_numline = (
|
||||||
self.get_numberlines('expression-weights',
|
self.get_numberlines('expression-weights',
|
||||||
['comparison', 'logical', 'brackets', 'unary'],
|
['brackets', 'comparison', 'logical', 'unary'],
|
||||||
[['less-than-or-equal', 'greater-than-or-equal', 'less-than', 'greater-than'], [], [], ['noop', 'negation']]))
|
excluded_values=[[], ['less-than-or-equal', 'greater-than-or-equal', 'less-than', 'greater-than'], [], ['noop', 'negation']]))
|
||||||
self.bool_unary = ['not']
|
self.bool_unary = ['not']
|
||||||
|
|
||||||
self.float_op_options, self.float_op_cutoffs, self.float_op_numline = (
|
self.float_op_options, self.float_op_cutoffs, self.float_op_numline = (
|
||||||
|
@ -80,7 +80,7 @@ class AstGenerator:
|
||||||
['brackets', 'comparison'],
|
['brackets', 'comparison'],
|
||||||
[[], []]))
|
[[], []]))
|
||||||
|
|
||||||
def get_numberlines(self, settings_section: str, subsettings: list[str], excluded_values: list[list[str or None]]):
|
def get_numberlines(self, settings_section: str, subsettings: list[str], excluded_values):
|
||||||
assert len(subsettings) == len(excluded_values)
|
assert len(subsettings) == len(excluded_values)
|
||||||
|
|
||||||
number_line = 0
|
number_line = 0
|
||||||
|
@ -103,6 +103,12 @@ class AstGenerator:
|
||||||
else:
|
else:
|
||||||
raise TypeError("invalid setting type. Found " + str(value) + " instead of expected int or dict")
|
raise TypeError("invalid setting type. Found " + str(value) + " instead of expected int or dict")
|
||||||
|
|
||||||
|
for v in range(len(settings)):
|
||||||
|
for i in excluded_values:
|
||||||
|
for j in i:
|
||||||
|
if j in settings[v]:
|
||||||
|
settings[v].pop(j)
|
||||||
|
|
||||||
for v in settings:
|
for v in settings:
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
for key, value in v.items():
|
for key, value in v.items():
|
||||||
|
|
Loading…
Reference in a new issue