Python docutils.parsers.rst.directives.choice() Examples
The following are 30
code examples of docutils.parsers.rst.directives.choice().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
docutils.parsers.rst.directives
, or try the search function
.
Example #1
Source File: __init__.py From bash-lambda-layer with MIT License | 6 votes |
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)))
Example #2
Source File: __init__.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
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)))
Example #3
Source File: __init__.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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)))
Example #4
Source File: __init__.py From deepWordBug with Apache License 2.0 | 6 votes |
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)))
Example #5
Source File: __init__.py From blackmamba with MIT License | 6 votes |
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)))
Example #6
Source File: __init__.py From aws-extender with MIT License | 6 votes |
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)))
Example #7
Source File: __init__.py From faces with GNU General Public License v2.0 | 6 votes |
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)))
Example #8
Source File: plot_directive.py From sklearn-evaluation with MIT License | 5 votes |
def _option_format(arg): return directives.choice(arg, ('python', 'doctest'))
Example #9
Source File: parts.py From aws-extender with MIT License | 5 votes |
def backlinks(arg): value = directives.choice(arg, Contents.backlinks_values) if value == 'none': return None else: return value
Example #10
Source File: plot_directive.py From sklearn-evaluation with MIT License | 5 votes |
def _option_align(arg): return directives.choice(arg, ("top", "middle", "bottom", "left", "center", "right"))
Example #11
Source File: mathmpl.py From ImageFusion with MIT License | 5 votes |
def fontset_choice(arg): return directives.choice(arg, ['cm', 'stix', 'stixsans'])
Example #12
Source File: tables.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def align(argument): return directives.choice(argument, ('left', 'center', 'right'))
Example #13
Source File: parts.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def backlinks(arg): value = directives.choice(arg, Contents.backlinks_values) if value == 'none': return None else: return value
Example #14
Source File: plot_directive.py From ImageFusion with MIT License | 5 votes |
def _option_context(arg): if arg in [None, 'reset']: return arg else: raise ValueError("argument should be None or 'reset'") return directives.choice(arg, ('None', 'reset'))
Example #15
Source File: tables.py From blackmamba with MIT License | 5 votes |
def align(argument): return directives.choice(argument, ('left', 'center', 'right'))
Example #16
Source File: parts.py From blackmamba with MIT License | 5 votes |
def backlinks(arg): value = directives.choice(arg, Contents.backlinks_values) if value == 'none': return None else: return value
Example #17
Source File: images.py From blackmamba with MIT License | 5 votes |
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)
Example #18
Source File: images.py From blackmamba with MIT License | 5 votes |
def align(argument): return directives.choice(argument, Figure.align_h_values)
Example #19
Source File: images.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def align(argument): return directives.choice(argument, Figure.align_h_values)
Example #20
Source File: images.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #21
Source File: parts.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def backlinks(arg): value = directives.choice(arg, Contents.backlinks_values) if value == 'none': return None else: return value
Example #22
Source File: tables.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def align(argument): return directives.choice(argument, ('left', 'center', 'right'))
Example #23
Source File: symbolator_sphinx.py From symbolator with MIT License | 5 votes |
def align_spec(argument): # type: (Any) -> bool return directives.choice(argument, ('left', 'center', 'right'))
Example #24
Source File: formfield_extension.py From lexpredict-contraxsuite with GNU Affero General Public License v3.0 | 5 votes |
def validate_deonticity_choice(argument): """ """ return directives.choice(argument, ('required', 'optional', 'complete_for'))
Example #25
Source File: images.py From bash-lambda-layer with MIT License | 5 votes |
def align(argument): return directives.choice(argument, Figure.align_h_values)
Example #26
Source File: images.py From bash-lambda-layer with MIT License | 5 votes |
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)
Example #27
Source File: parts.py From bash-lambda-layer with MIT License | 5 votes |
def backlinks(arg): value = directives.choice(arg, Contents.backlinks_values) if value == 'none': return None else: return value
Example #28
Source File: tables.py From bash-lambda-layer with MIT License | 5 votes |
def align(argument): return directives.choice(argument, ('left', 'center', 'right'))
Example #29
Source File: plot_directive.py From artview with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _option_format(arg): return directives.choice(arg, ('python', 'lisp'))
Example #30
Source File: images.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
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)