def make_list(kwargs): serial_args, keyword_args = util.serialize_args('search', **kwargs) keyword_args = util.listify_args('sort_by', 'headings', **keyword_args) if not keyword_args['sort_by']: keyword_args.pop('sort_by') if not keyword_args['headings']: keyword_args.pop('headings') return commands.listing.make_list(*serial_args, **keyword_args)
def test_removes_empties(self): args = util.listify_args('list', **{'list': ',', 'not_list': 'hammer, spanner, prybar'}) assert args['list'] == []
def test_skips_none(self): args = util.listify_args('list', **{'list': None, 'not_list': 'hammer, spanner, prybar'}) assert args['list'] is None
def test_modifies_named_strings(self): args = util.listify_args('list', **{'list': '1, 2, 3', 'not_list': 'hammer, spanner, prybar'}) assert args['list'] == ['1', '2', '3'] assert args['not_list'] == 'hammer, spanner, prybar'
def dump(kwargs): serial_args, keyword_args = util.serialize_args('search', **kwargs) keyword_args = util.listify_args('sort_by', **keyword_args) if not keyword_args['sort_by']: keyword_args.pop('sort_by') return commands.dump(*serial_args, **keyword_args)