本文整理汇总了Python中store.Store.has_node方法的典型用法代码示例。如果您正苦于以下问题:Python Store.has_node方法的具体用法?Python Store.has_node怎么用?Python Store.has_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.has_node方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _jsonstr_other
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import has_node [as 别名]
def _jsonstr_other(self, thing):
'Do our best to make JSON out of a "normal" python object - the final "other" case'
ret = '{'
comma = ''
attrs = thing.__dict__.keys()
attrs.sort()
if Store.has_node(thing) and Store.id(thing) is not None:
ret += '"_id": %s' % str(Store.id(thing))
comma = ','
for attr in attrs:
skip = False
for prefix in self.filterprefixes:
if attr.startswith(prefix):
skip = True
continue
if skip:
continue
value = getattr(thing, attr)
if self.maxJSON > 0 and attr.startswith('JSON_') and len(value) > self.maxJSON:
continue
if self.expandJSON and attr.startswith('JSON_') and value.startswith('{'):
js = pyConfigContext(value)
if js is not None:
value = js
ret += '%s"%s":%s' % (comma, attr, self._jsonstr(value))
comma = ','
ret += '}'
return ret
示例2: __str__
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import has_node [as 别名]
def __str__(self):
'Default routine for printing CMAclass objects'
result = '%s({' % self.__class__.__name__
comma = ''
for attr in Store.safe_attrs(self):
result += '%s%s = %s'% (comma, attr, str(getattr(self, attr)))
comma = ",\n "
if Store.has_node(self):
if Store.is_abstract(self):
result += comma + 'HasNode = "abstract"'
else:
result += (comma + 'HasNode = %d' %Store.id(self))
result += "\n})"
return result
示例3: __str__
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import has_node [as 别名]
def __str__(self):
"Default routine for printing GraphNodes"
result = "%s({" % self.__class__.__name__
comma = ""
for attr in Store.safe_attrs(self):
result += "%s%s = %s" % (comma, attr, str(getattr(self, attr)))
comma = ",\n "
if Store.has_node(self):
if Store.is_abstract(self):
result += comma + 'HasNode = "abstract"'
else:
result += comma + "HasNode = %d" % Store.id(self)
result += "\n})"
return result