本文整理汇总了Python中context.Context.delete_path方法的典型用法代码示例。如果您正苦于以下问题:Python Context.delete_path方法的具体用法?Python Context.delete_path怎么用?Python Context.delete_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类context.Context
的用法示例。
在下文中一共展示了Context.delete_path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: baseVertex
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import delete_path [as 别名]
#.........这里部分代码省略.........
if self.context.is_visited_vertex(uuid):
self.ref_vertexes.append(self.context.get_vertex_of_uuid(uuid))
continue
vertex = self._store_vertex(vertex_type, uuid, obj)
self.store_config(vertex)
self._store_config_schema(vertex)
self.store_control_config(vertex)
self.store_analytics_uves(vertex)
if self.non_config_obj == False:
self.vrouter[uuid] = self.get_vrouter_info(vertex)
vrouter_nodes = self.vrouter[uuid].get_nodes()
if not vrouter_nodes:
self.logger.error('Unable to find vrouter for %s:%s' % (self.vertex_type,
uuid))
self.context.add_vrouter(vrouter_nodes, self.vertex_type,
uuid, obj[vertex_type]['fq_name'])
self.store_agent_config(vertex)
self.process_self(vertex)
if self.depth == self.context.depth:
continue
if getattr(self, 'dependant_vertexes', None):
self._process_dependants(vertex, obj)
if self.non_config_obj == True:
self.vrouter[uuid] = self.get_vrouter_info(vertex)
self.store_agent_config(vertex)
self.process_self(vertex)
def _add_to_context_path(self, element):
self.current_frame = element
self.context.add_path(element)
self.logger.debug('Add '+ str(self.context.get_path()))
def _remove_from_context_path(self, element):
self.context.delete_path(element)
self.logger.debug('Remove' + str(self.context.get_path()))
def _process_dependants(self, vertex, obj):
element = self._create_element(vertex=vertex,
**obj[self.vertex_type])
for dependant_vertex in self.dependant_vertexes:
self._add_to_context_path(element)
self.dependent_vertex_objs.append(
dependant_vertex(context=self.context, element=element))
self._remove_from_context_path(element)
def get_dependent_vertices(self):
return self.dependent_vertex_objs
def create_vertex(self, vertex_type, **kwargs):
vertex = defaultdict(dict)
vertex.update({
'vertex_type': vertex_type,
'config': {},
'agent' : defaultdict(dict),
'control': defaultdict(dict),
'analytics': {'uve':{}},
})
for k,v in kwargs.iteritems():
vertex.update({k: v})
return vertex
def get_vertex(self):
return self.vertexes
def _store_vertex(self, vertex_type, uuid, config_obj):
fq_name = config_obj[vertex_type].get('fq_name', uuid)