summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2012-05-07 11:13:19 -0500
committerDean Troyer <dtroyer@gmail.com>2012-05-07 14:05:22 -0500
commita7da2b8008c7429eab270aa937f563dfa3353afa (patch)
treefb75152f153ea65a47086ef6f1ecc48348c13a65 /openstackclient
parent70b3246a1983700736b7ce4c83e9381d987cc598 (diff)
downloadpython-openstackclient-a7da2b8008c7429eab270aa937f563dfa3353afa.tar.gz
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
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/common/utils.py54
1 files changed, 0 insertions, 54 deletions
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')