當前位置: 首頁>>代碼示例>>Python>>正文


Python directives.choice方法代碼示例

本文整理匯總了Python中docutils.parsers.rst.directives.choice方法的典型用法代碼示例。如果您正苦於以下問題:Python directives.choice方法的具體用法?Python directives.choice怎麽用?Python directives.choice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在docutils.parsers.rst.directives的用法示例。


在下文中一共展示了directives.choice方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: choice

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def choice(argument, values):
    """
    Directive option utility function, supplied to enable options whose
    argument must be a member of a finite set of possible values (must be
    lower case).  A custom conversion function must be written to use it.  For
    example::

        from docutils.parsers.rst import directives

        def yesno(argument):
            return directives.choice(argument, ('yes', 'no'))

    Raise ``ValueError`` if no argument is found or if the argument's value is
    not valid (not an entry in the supplied list).
    """
    try:
        value = argument.lower().strip()
    except AttributeError:
        raise ValueError('must supply an argument; choose from %s'
                         % format_values(values))
    if value in values:
        return value
    else:
        raise ValueError('"%s" unknown; choose from %s'
                         % (argument, format_values(values))) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:27,代碼來源:__init__.py

示例2: align_spec

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def align_spec(argument):
    # type: (Any) -> bool
    return directives.choice(argument, ('left', 'center', 'right')) 
開發者ID:kevinpt,項目名稱:symbolator,代碼行數:5,代碼來源:symbolator_sphinx.py

示例3: align

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right')) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:4,代碼來源:tables.py

示例4: backlinks

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value 
開發者ID:skarlekar,項目名稱:faces,代碼行數:8,代碼來源:parts.py

示例5: align

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def align(argument):
        # This is not callable as self.align.  We cannot make it a
        # staticmethod because we're saving an unbound method in
        # option_spec below.
        return directives.choice(argument, Image.align_values) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:7,代碼來源:images.py

示例6: _option_format

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def _option_format(arg):
    return directives.choice(arg, ('python', 'doctest')) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:4,代碼來源:plot_directive.py

示例7: _option_align

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right")) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:5,代碼來源:plot_directive.py

示例8: fontset_choice

# 需要導入模塊: from docutils.parsers.rst import directives [as 別名]
# 或者: from docutils.parsers.rst.directives import choice [as 別名]
def fontset_choice(arg):
    return directives.choice(arg, ['cm', 'stix', 'stixsans']) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:4,代碼來源:mathmpl.py


注:本文中的docutils.parsers.rst.directives.choice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。