Python docutils.parsers.rst.directives 模块,choice() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用docutils.parsers.rst.directives.choice()

项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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)))
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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)))
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
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)))
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
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)))
项目:RST-vscode    作者:tht13    | 项目源码 | 文件源码
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)))
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
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)))
项目:palladio    作者:slipguru    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'lisp'))
项目:palladio    作者:slipguru    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right'))
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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)
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def align(argument):
        return directives.choice(argument, Figure.align_h_values)
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right'))
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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)
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def align(argument):
        return directives.choice(argument, Figure.align_h_values)
项目:henet    作者:AcrDijon    | 项目源码 | 文件源码
def align(argument):
    """Conversion function for the "align" option."""
    return directives.choice(argument, ('left', 'center', 'right'))
项目:sphinx-nbexamples    作者:Chilipp    | 项目源码 | 文件源码
def align(argument):
    """Conversion function for the "align" option."""
    return directives.choice(argument, ('left', 'center', 'right'))
项目:bolero    作者:rock-learning    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'lisp'))
项目:bolero    作者:rock-learning    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:terra    作者:UW-Hydro    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'doctest'))
项目:terra    作者:UW-Hydro    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:NOFAInsert    作者:NINAnor    | 项目源码 | 文件源码
def align(argument):
    """Conversion function for the "align" option."""
    return directives.choice(argument, ('left', 'center', 'right'))
项目:dalila    作者:slipguru    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'lisp'))
项目:dalila    作者:slipguru    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:scipy-lecture-notes-zh-CN    作者:jayleicn    | 项目源码 | 文件源码
def fontset_choice(arg):
    return directives.choice(arg, ['cm', 'stix', 'stixsans'])
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
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)
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def align(argument):
        return directives.choice(argument, Figure.align_h_values)
项目:icing    作者:slipguru    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'lisp'))
项目:icing    作者:slipguru    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:tensorly    作者:tensorly    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'lisp'))
项目:tensorly    作者:tensorly    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right'))
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
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)
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def align(argument):
        return directives.choice(argument, Figure.align_h_values)
项目:symbolator    作者:kevinpt    | 项目源码 | 文件源码
def align_spec(argument):
    # type: (Any) -> bool
    return directives.choice(argument, ('left', 'center', 'right'))
项目:RST-vscode    作者:tht13    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:RST-vscode    作者:tht13    | 项目源码 | 文件源码
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right'))
项目:RST-vscode    作者:tht13    | 项目源码 | 文件源码
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)
项目:RST-vscode    作者:tht13    | 项目源码 | 文件源码
def align(argument):
        return directives.choice(argument, Figure.align_h_values)
项目:opcsim    作者:dhhagan    | 项目源码 | 文件源码
def _option_format(arg):
    return directives.choice(arg, ('python', 'doctest'))
项目:opcsim    作者:dhhagan    | 项目源码 | 文件源码
def _option_align(arg):
    return directives.choice(arg, ("top", "middle", "bottom", "left", "center",
                                   "right"))
项目:deviation-manual    作者:DeviationTX    | 项目源码 | 文件源码
def csharp_unicodelevel(argument):
    return directives.choice(argument, ('none', 'basic', 'full'))
项目:deviation-manual    作者:DeviationTX    | 项目源码 | 文件源码
def lhs_litstyle(argument):
    return directives.choice(argument, ('bird', 'latex'))
项目:deviation-manual    作者:DeviationTX    | 项目源码 | 文件源码
def raw_compress(argument):
    return directives.choice(argument, ('gz', 'bz2'))




# Register Directive
# ------------------
# ::
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
def backlinks(arg):
        value = directives.choice(arg, Contents.backlinks_values)
        if value == 'none':
            return None
        else:
            return value
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
def align(argument):
    return directives.choice(argument, ('left', 'center', 'right'))
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
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)