From a7da2b8008c7429eab270aa937f563dfa3353afa Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 7 May 2012 11:13:19 -0500 Subject: Remove printt Remove unused common.utils functions prettyprint 0.6 removed printt at the last minute, our references to it turned out to be in unused code; remove it. Change-Id: I38a4d9a169beaecfd53eafc5b10f06201bac0c31 --- openstackclient/common/utils.py | 54 ----------------------------------------- 1 file changed, 54 deletions(-) (limited to 'openstackclient/common/utils.py') diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 9e704c97..fe0e5bcb 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -27,45 +27,6 @@ import prettytable from openstackclient.common import exceptions -# Decorator for cli-args -def arg(*args, **kwargs): - def _decorator(func): - # Because of the sematics of decorator composition if we just append - # to the options list positional options will appear to be backwards. - func.__dict__.setdefault('arguments', []).insert(0, (args, kwargs)) - return func - return _decorator - - -def pretty_choice_list(l): - return ', '.join("'%s'" % i for i in l) - - -def print_list(objs, fields, formatters={}): - pt = prettytable.PrettyTable([f for f in fields], caching=False) - pt.aligns = ['l' for f in fields] - - for o in objs: - row = [] - for field in fields: - if field in formatters: - row.append(formatters[field](o)) - else: - field_name = field.lower().replace(' ', '_') - data = getattr(o, field_name, '') - row.append(data) - pt.add_row(row) - - pt.printt(sortby=fields[0]) - - -def print_dict(d): - pt = prettytable.PrettyTable(['Property', 'Value'], caching=False) - pt.aligns = ['l', 'l'] - [pt.add_row(list(r)) for r in d.iteritems()] - pt.printt(sortby='Property') - - def find_resource(manager, name_or_id): """Helper for the _find_* methods.""" # first try to get entity as integer id @@ -91,21 +52,6 @@ def find_resource(manager, name_or_id): raise exceptions.CommandError(msg) -def skip_authentication(f): - """Function decorator used to indicate a caller may be unauthenticated.""" - f.require_authentication = False - return f - - -def is_authentication_required(f): - """Checks to see if the function requires authentication. - - Use the skip_authentication decorator to indicate a caller may - skip the authentication step. - """ - return getattr(f, 'require_authentication', True) - - def string_to_bool(arg): return arg.strip().lower() in ('t', 'true', 'yes', '1') -- cgit v1.2.1