def nonnegative_int_list(argument): """ Converts a space- or comma-separated list of values into a Python list of integers. (Directive option conversion function.) Raises ValueError for values that aren't non-negative integers. """ if ',' in argument: entries = argument.split(',') else: entries = argument.split() return [directives.nonnegative_int(entry) for entry in entries]
def run(self): id = directives.nonnegative_int(self.arguments.pop(0)) log.debug(self.arguments) return [ nodes.raw( '', self.html.format( path=self.widget_path, id=id, type=self.type, autoplay=('autoplay&' if 'autoplay' in self.arguments else '') ), format='html' ) ]
def nonnegative_int_list(argument): if ',' in argument: entries = argument.split(',') else: entries = argument.split() return [directives.nonnegative_int(entry) for entry in entries]
def figwidth_value(argument): if argument.lower() == 'image': return 'image' else: return directives.nonnegative_int(argument)
def figwidth_value(argument): if argument.lower() == "image": return "image" else: return directives.nonnegative_int(argument)
def nonnegative_int_or_all(argument): if argument == 'all': return return nonnegative_int(argument)