Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ldots #993

Merged
merged 7 commits into from
Oct 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions mathics/builtin/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def apply_levelspec(self, expr, rules, ls, evaluation, options):
return result
except InvalidLevelspecError:
evaluation.message('General', 'level', ls)
except PatternError as e:

except PatternError:
evaluation.message('Replace','reps', rules)


Expand Down Expand Up @@ -277,7 +278,7 @@ def apply(self, expr, rules, evaluation):

result, applied = expr.apply_rules(rules, evaluation)
return result
except PatternError as e:
except PatternError:
evaluation.message('Replace','reps', rules)


Expand Down Expand Up @@ -316,7 +317,7 @@ def apply_list(self, expr, rules, evaluation):
'ReplaceRepeated[expr_, rules_]'
try:
rules, ret = create_rules(rules, expr, 'ReplaceRepeated', evaluation)
except PatternError as e:
except PatternError:
evaluation.message('Replace','reps', rules)
return None

Expand Down Expand Up @@ -386,7 +387,7 @@ def apply(self, expr, rules, max, evaluation):
try:
rules, ret = create_rules(
rules, expr, 'ReplaceList', evaluation, extra_args=[max])
except PatternError as e:
except PatternError:
evaluation.message('Replace','reps', rules)
return None

Expand Down Expand Up @@ -1127,8 +1128,8 @@ def init(self, expr, min=1):
self.min = min
if len(expr.leaves) == 2:
leaf_1 = expr.leaves[1]
allnumbers = all(not (leaf.get_int_value() is None) for leaf in leaf_1.get_leaves())
if (leaf_1.has_form('List', 1, 2) and allnumbers ):
allnumbers = not any(leaf.get_int_value() is None for leaf in leaf_1.get_leaves())
if leaf_1.has_form('List', 1, 2) and allnumbers:
self.max = leaf_1.leaves[-1].get_int_value()
self.min = leaf_1.leaves[0].get_int_value()
elif leaf_1.get_int_value():
Expand Down