本文整理汇总了Python中neutronclient.common.utils.get_item_properties函数的典型用法代码示例。如果您正苦于以下问题:Python get_item_properties函数的具体用法?Python get_item_properties怎么用?Python get_item_properties使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_item_properties函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setup_columns
def setup_columns(self, info, parsed_args):
_columns = len(info) > 0 and sorted(info[0].keys()) or []
if not _columns:
# clean the parsed_args.columns so that cliff will not break
parsed_args.columns = []
elif parsed_args.columns:
_columns = [x for x in parsed_args.columns if x in _columns]
elif self.list_columns:
# if no -c(s) by user and list_columns, we use columns in
# both list_columns and returned resource.
# Also Keep their order the same as in list_columns
_columns = self._setup_columns_with_tenant_id(self.list_columns,
_columns)
if parsed_args.formatter == 'table':
formatters = self._formatters
elif (parsed_args.formatter == 'csv'
and hasattr(self, '_formatters_csv')):
formatters = self._formatters_csv
else:
# For other formatters, we use raw value returned from neutron
formatters = {}
return (_columns, (utils.get_item_properties(
s, _columns, formatters=formatters, )
for s in info), )
开发者ID:huntxu,项目名称:python-neutronclient,代码行数:26,代码来源:__init__.py
示例2: take_action
def take_action(self, parsed_args):
debug_agent = self.get_debug_agent()
info = debug_agent.list_probes()
columns = sorted(info[0].keys()) if info else []
return (columns, (utils.get_item_properties(
s, columns, formatters=self._formatters, )
for s in info), )
开发者ID:cubeek,项目名称:neutron,代码行数:7,代码来源:commands.py
示例3: get_data
def get_data(self, parsed_args):
debug_agent = self.get_debug_agent()
info = debug_agent.list_probes()
columns = len(info) > 0 and sorted(info[0].keys()) or []
return (columns, (utils.get_item_properties(
s, columns, formatters=self._formatters, )
for s in info), )
开发者ID:50infivedays,项目名称:neutron,代码行数:8,代码来源:commands.py
示例4: test_get_object_item_desired_fields_is_empty
def test_get_object_item_desired_fields_is_empty(self):
class Fake(object):
def __init__(self):
self.id = 'test_id_1'
self.name = 'test_name'
self.test_user = 'test'
fields = []
item = Fake()
actual = utils.get_item_properties(item, fields)
self.assertEqual((), actual)
开发者ID:ChameleonCloud,项目名称:python-neutronclient,代码行数:11,代码来源:test_utils.py
示例5: test_get_object_item_desired_fields_differ_from_item
def test_get_object_item_desired_fields_differ_from_item(self):
class Fake(object):
def __init__(self):
self.id = 'test_id_1'
self.name = 'test_name'
self.test_user = 'test'
fields = ('name', 'id', 'test user')
item = Fake()
actual = utils.get_item_properties(item, fields)
self.assertNotEqual(('test_name', 'test_id', 'test'), actual)
开发者ID:ChameleonCloud,项目名称:python-neutronclient,代码行数:11,代码来源:test_utils.py
示例6: test_get_object_item_properties_mixed_case_fields
def test_get_object_item_properties_mixed_case_fields(self):
class Fake(object):
def __init__(self):
self.id = 'test_id'
self.name = 'test_name'
self.test_user = 'test'
fields = ('name', 'id', 'test user')
mixed_fields = ('test user', 'ID')
item = Fake()
actual = utils.get_item_properties(item, fields, mixed_fields)
self.assertEqual(('test_name', 'test_id', 'test'), actual)
开发者ID:ChameleonCloud,项目名称:python-neutronclient,代码行数:12,代码来源:test_utils.py
示例7: take_action
def take_action(self, parsed_args):
self.log.debug("run(%s)", parsed_args)
neutron_client = self.get_client()
search_opts = {}
self.log.debug("search options: %s", search_opts)
obj_lister = getattr(neutron_client, "list_%ss" % self.resource)
data = obj_lister(**search_opts)
info = []
collection = self.resource + "s"
if collection in data:
info = data[collection]
_columns = len(info) > 0 and sorted(info[0].keys()) or []
return (_columns, (utils.get_item_properties(s, _columns) for s in info))
开发者ID:hmonika,项目名称:python-neutronclient,代码行数:13,代码来源:quota.py
示例8: setup_columns
def setup_columns(self, info, parsed_args):
_columns = len(info) > 0 and sorted(info[0].keys()) or []
if not _columns:
# clean the parsed_args.columns so that cliff will not break
parsed_args.columns = []
elif parsed_args.columns:
_columns = [x for x in parsed_args.columns if x in _columns]
elif self.list_columns:
# if no -c(s) by user and list_columns, we use columns in
# both list_columns and returned resource.
# Also Keep their order the same as in list_columns
_columns = [x for x in self.list_columns if x in _columns]
return (_columns, (utils.get_item_properties(s, _columns, formatters=self._formatters) for s in info))
开发者ID:ntt-sic,项目名称:python-neutronclient,代码行数:13,代码来源:__init__.py
示例9: test_get_object_item_with_formatters
def test_get_object_item_with_formatters(self):
class Fake(object):
def __init__(self):
self.id = 'test_id'
self.name = 'test_name'
self.test_user = 'test'
class FakeCallable(object):
def __call__(self, *args, **kwargs):
return 'pass'
fields = ('name', 'id', 'test user', 'is_public')
formatters = {'is_public': FakeCallable()}
item = Fake()
act = utils.get_item_properties(item, fields, formatters=formatters)
self.assertEqual(('test_name', 'test_id', 'test', 'pass'), act)
开发者ID:ChameleonCloud,项目名称:python-neutronclient,代码行数:16,代码来源:test_utils.py
示例10: test_get_dict_item_properties
def test_get_dict_item_properties(self):
item = {'name': 'test_name', 'id': 'test_id'}
fields = ('name', 'id')
actual = utils.get_item_properties(item=item, fields=fields)
self.assertEqual(('test_name', 'test_id'), actual)
开发者ID:ChameleonCloud,项目名称:python-neutronclient,代码行数:5,代码来源:test_utils.py
注:本文中的neutronclient.common.utils.get_item_properties函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论