当前位置: 首页>>代码示例>>Python>>正文


Python Store.has_node方法代码示例

本文整理汇总了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
开发者ID:JJediny,项目名称:assimilation-official,代码行数:30,代码来源:assimjson.py

示例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
开发者ID:borgified,项目名称:testroot,代码行数:17,代码来源:graphnodes.py

示例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
开发者ID:Alan-R,项目名称:assimilation-persistent-events,代码行数:17,代码来源:graphnodes.py


注:本文中的store.Store.has_node方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。