本文整理汇总了Python中block.Block.from_full_name方法的典型用法代码示例。如果您正苦于以下问题:Python Block.from_full_name方法的具体用法?Python Block.from_full_name怎么用?Python Block.from_full_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block.Block
的用法示例。
在下文中一共展示了Block.from_full_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _block_name
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import from_full_name [as 别名]
def _block_name(self):
if type(self._block) is str:
return Block.from_full_name(self._block)[1]
elif self._block is None:
return None
else:
return self._block.name
示例2: _dataset_name
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import from_full_name [as 别名]
def _dataset_name(self):
if type(self._block) is str:
return Block.from_full_name(self._block)[0]
elif self._block is None:
return None
else:
return self._block.dataset.name
示例3: _block_real_name
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import from_full_name [as 别名]
def _block_real_name(self):
if type(self._block) is str:
return Block.to_real_name(Block.from_full_name(self._block)[1])
elif self._block is None:
return None
else:
return self._block.real_name()
示例4: find_items
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import from_full_name [as 别名]
def find_items(self, inventory, invalid_items = None):
"""
Find datasets and blocks in the items list from the inventory.
@param inventory DynamoInventory object
@param invalid_items If set to a list, fill with item names not found in the inventory.
@return {dataset: set of blocks or None}, None if the item is a dataset.
"""
datasets = {}
for item in self.items:
try:
dataset = inventory.datasets[item]
except KeyError:
try:
dataset_name, block_name = Block.from_full_name(item)
except ObjectError:
if invalid_items is not None:
invalid_items.append(item)
continue
try:
dataset = inventory.datasets[dataset_name]
except KeyError:
if invalid_items is not None:
invalid_items.append(item)
continue
if dataset in datasets and datasets[dataset] is None:
continue
block = dataset.find_block(block_name)
if block is None:
if invalid_items is not None:
invalid_items.append(item)
continue
if dataset in datasets:
datasets[dataset].add(block)
else:
datasets[dataset] = set([block])
else:
datasets[dataset] = None
return datasets