本文整理汇总了Python中trove.common.utils.is_collection函数的典型用法代码示例。如果您正苦于以下问题:Python is_collection函数的具体用法?Python is_collection怎么用?Python is_collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_collection函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _to_rows
def _to_rows(self, header, items):
rows = []
if trove_utils.is_collection(items):
if any(trove_utils.is_collection(item) for item in items):
# This is multi-row property.
for item in items:
rows.extend(self._to_rows(header, item))
else:
# This is a single-row property with multiple arguments.
rows.append(self._to_list(header, self._string_converter.to_strings(items)))
else:
# This is a single-row property with only one argument.
rows.append(self._to_list(header, items))
return rows
开发者ID:magictour,项目名称:trove,代码行数:15,代码来源:stream_codecs.py
示例2: assert_instance_action
def assert_instance_action(
self, instance_ids, expected_states, expected_http_code):
self.assert_client_code(expected_http_code)
if expected_states:
self.assert_all_instance_states(
instance_ids if utils.is_collection(instance_ids)
else [instance_ids], expected_states)
开发者ID:cdelatte,项目名称:tesora-trove,代码行数:7,代码来源:test_runners.py
示例3: assert_delete_instances
def assert_delete_instances(self, instance_ids, expected_http_code):
instance_ids = (instance_ids if utils.is_collection(instance_ids)
else [instance_ids])
client = self.auth_client
for instance_id in instance_ids:
client.instances.delete(instance_id)
self.assert_client_code(client, expected_http_code)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:replication_runners.py
示例4: append_option_group
def append_option_group(opt_group, cmd_opts):
for name, value in opt_group.items():
if utils.is_collection(value):
for item in value:
append_option(name, item, cmd_opts)
else:
append_option(name, value, cmd_opts)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:service.py
示例5: to_objects
def to_objects(self, items):
"""Recursively convert collection string to objects.
:returns: Copy of the input collection with all items converted.
"""
if trove_utils.is_collection(items):
return map(self.to_objects, items)
return self._to_object(items)
开发者ID:magictour,项目名称:trove,代码行数:9,代码来源:stream_codecs.py
示例6: assert_delete_instances
def assert_delete_instances(
self, instance_ids, expected_last_state, expected_http_code):
instance_ids = (instance_ids if utils.is_collection(instance_ids)
else [instance_ids])
for instance_id in instance_ids:
self.auth_client.instances.delete(instance_id)
self.assert_client_code(expected_http_code)
self.assert_all_gone(instance_ids, expected_last_state)
开发者ID:HoratiusTang,项目名称:trove,代码行数:9,代码来源:replication_runners.py
示例7: _to_list
def _to_list(self, *items):
container = []
for item in items:
if trove_utils.is_collection(item):
# This item is a nested collection - unpack it.
container.extend(self._to_list(*item))
else:
# This item is not a collection - append it to the list.
container.append(item)
return container
开发者ID:magictour,项目名称:trove,代码行数:11,代码来源:stream_codecs.py
示例8: assert_all_gone
def assert_all_gone(self, instance_ids, expected_last_status):
self._wait_all_deleted(instance_ids
if utils.is_collection(instance_ids)
else [instance_ids], expected_last_status)
开发者ID:cdelatte,项目名称:tesora-trove,代码行数:4,代码来源:test_runners.py
示例9: assert_instance_action
def assert_instance_action(self, instance_ids, expected_states):
if expected_states:
self.assert_all_instance_states(
instance_ids if utils.is_collection(instance_ids)
else [instance_ids], expected_states)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:5,代码来源:test_runners.py
示例10: add_inst_ids
def add_inst_ids(mcs, inst_ids):
if not utils.is_collection(inst_ids):
inst_ids = [inst_ids]
debug_inst_ids = mcs.get_inst_ids()
debug_inst_ids |= set(inst_ids)
mcs._data['inst_ids'] = debug_inst_ids
开发者ID:Tesora,项目名称:tesora-trove,代码行数:6,代码来源:test_runners.py
注:本文中的trove.common.utils.is_collection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论