[PATCH 3 of 3] minirst: remove redundant _admonitions set

Gregory Szorc gregory.szorc at gmail.com
Wed Mar 29 23:19:42 EDT 2017


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1490843966 25200
#      Wed Mar 29 20:19:26 2017 -0700
# Node ID 191b0b4697cc979464ec5ad9f04ef1ffa0f2a6cb
# Parent  c4329b811738046b70661f5647df50d7d28b2362
minirst: remove redundant _admonitions set

As Yuya pointed out during a review a month ago, _admonitions and
_admonitiontitles are largely redundant. With the last commit, they
are exactly redundant. So, remove _admonitions and use
_admonitiontitles.keys() instead.

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -413,24 +413,12 @@ def prunecomments(blocks):
     return blocks
 
 
-_admonitions = set([
-    'attention',
-    'caution',
-    'danger',
-    'error',
-    'hint',
-    'important',
-    'note',
-    'tip',
-    'warning',
-])
-
 def findadmonitions(blocks, admonitions=None):
     """
     Makes the type of the block an admonition block if
     the first line is an admonition directive
     """
-    admonitions = admonitions or _admonitions
+    admonitions = admonitions or _admonitiontitles.keys()
 
     admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)),
                               flags=re.IGNORECASE)


More information about the Mercurial-devel mailing list