def render_factory(self, question_type): matrix = { 'text': Text, 'password': Password, 'confirm': Confirm, 'list': List, 'checkbox': Checkbox, } if question_type not in matrix: raise errors.UnknownQuestionTypeError() return matrix.get(question_type)
def render_factory(self, question_type): matrix = { "text": Text, "editor": Editor, "password": Password, "confirm": Confirm, "list": List, "checkbox": Checkbox, "path": Path, } if question_type not in matrix: raise errors.UnknownQuestionTypeError() return matrix.get(question_type)
def render_factory(self, question_type): matrix = { 'text': Text, 'editor': Editor, 'password': Password, 'confirm': Confirm, 'list': List, 'listbox': ListBox, # added for custom `ListBox` question 'checkbox': Checkbox, 'path': Path, } if question_type not in matrix: raise errors.UnknownQuestionTypeError() return matrix.get(question_type)
def question_factory(kind, *args, **kwargs): for cl in (Text, Editor, Password, Confirm, List, Checkbox, Path): if cl.kind == kind: return cl(*args, **kwargs) raise errors.UnknownQuestionTypeError()