Skip to content

Commit

Permalink
fine details
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Nov 2, 2023
1 parent e49fb85 commit ecbd9ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sage/doctest/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def fake_RIFtol(*args):
ansi_escape_sequence = re.compile(r'(\x1b[@-Z\\-~]|\x1b\[.*?[@-~]|\x9b.*?[@-~])')

special_optional_regex = 'arb216|arb218|py2|long time|not implemented|not tested|known bug'
tag_with_explanation_regex = fr'((?:\w|[.])+)\s*(?:\((.*?)\))?'
tag_with_explanation_regex = r'((?:\w|[.])+)\s*(?:\((.*?)\))?'
optional_regex = re.compile(fr'(?P<cmd>{special_optional_regex})\s*(?:\((?P<cmd_explanation>.*?)\))?|'
fr'[^ a-z]\s*(optional|needs)(?:\s|[:-])*(?P<tags>(?:(?:{tag_with_explanation_regex})\s*)*)',
re.IGNORECASE)
Expand Down Expand Up @@ -470,7 +470,7 @@ def update_optional_tags(line, tags=None, *, add_tags=None, remove_tags=None, fo
| V V V V V V v v v v
| sage: # optional - magma, needs sage.symbolic
"""
if not (m := re.match('( *sage: *)(.*)', line)):
if not re.match('( *sage: *)(.*)', line):
raise ValueError(f'line must start with a sage: prompt, got: {line}')

current_tags, line_sans_tags, is_persistent = parse_optional_tags(line.rstrip(), return_string_sans_tags=True)
Expand Down Expand Up @@ -1141,7 +1141,7 @@ def update_tag_counts(optional_tags):
def check_and_clear_tag_counts():
if (num_examples := tag_count_within_block['']) >= 4:
if overused_tags := {tag for tag, count in tag_count_within_block.items()
if tag and count >= num_examples}:
if tag and count >= num_examples}:
overused_tags.update(persistent_optional_tags)
overused_tags.difference_update(self.file_optional_tags)
suggested = unparse_optional_tags(overused_tags, prefix='sage: # ')
Expand Down Expand Up @@ -1211,9 +1211,9 @@ def check_and_clear_tag_counts():

if self.optional_tags is not True:
extra = {tag
for tag in optional_tags
if (tag not in self.optional_tags
and tag not in available_software)}
for tag in optional_tags
if (tag not in self.optional_tags
and tag not in available_software)}
if extra:
if any(tag in external_software for tag in extra):
# never probe "external" software
Expand Down

0 comments on commit ecbd9ac

Please sign in to comment.