Skip to content

Commit a7da2b8

Browse files
author
Dean Troyer
committed
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
1 parent 70b3246 commit a7da2b8

1 file changed

Lines changed: 0 additions & 54 deletions

File tree

openstackclient/common/utils.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,6 @@
2727
from openstackclient.common import exceptions
2828

2929

30-
# Decorator for cli-args
31-
def arg(*args, **kwargs):
32-
def _decorator(func):
33-
# Because of the sematics of decorator composition if we just append
34-
# to the options list positional options will appear to be backwards.
35-
func.__dict__.setdefault('arguments', []).insert(0, (args, kwargs))
36-
return func
37-
return _decorator
38-
39-
40-
def pretty_choice_list(l):
41-
return ', '.join("'%s'" % i for i in l)
42-
43-
44-
def print_list(objs, fields, formatters={}):
45-
pt = prettytable.PrettyTable([f for f in fields], caching=False)
46-
pt.aligns = ['l' for f in fields]
47-
48-
for o in objs:
49-
row = []
50-
for field in fields:
51-
if field in formatters:
52-
row.append(formatters[field](o))
53-
else:
54-
field_name = field.lower().replace(' ', '_')
55-
data = getattr(o, field_name, '')
56-
row.append(data)
57-
pt.add_row(row)
58-
59-
pt.printt(sortby=fields[0])
60-
61-
62-
def print_dict(d):
63-
pt = prettytable.PrettyTable(['Property', 'Value'], caching=False)
64-
pt.aligns = ['l', 'l']
65-
[pt.add_row(list(r)) for r in d.iteritems()]
66-
pt.printt(sortby='Property')
67-
68-
6930
def find_resource(manager, name_or_id):
7031
"""Helper for the _find_* methods."""
7132
# first try to get entity as integer id
@@ -91,21 +52,6 @@ def find_resource(manager, name_or_id):
9152
raise exceptions.CommandError(msg)
9253

9354

94-
def skip_authentication(f):
95-
"""Function decorator used to indicate a caller may be unauthenticated."""
96-
f.require_authentication = False
97-
return f
98-
99-
100-
def is_authentication_required(f):
101-
"""Checks to see if the function requires authentication.
102-
103-
Use the skip_authentication decorator to indicate a caller may
104-
skip the authentication step.
105-
"""
106-
return getattr(f, 'require_authentication', True)
107-
108-
10955
def string_to_bool(arg):
11056
return arg.strip().lower() in ('t', 'true', 'yes', '1')
11157

0 commit comments

Comments
 (0)