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


Python Store.safe_attrs方法代码示例

本文整理汇总了Python中store.Store.safe_attrs方法的典型用法代码示例。如果您正苦于以下问题:Python Store.safe_attrs方法的具体用法?Python Store.safe_attrs怎么用?Python Store.safe_attrs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在store.Store的用法示例。


在下文中一共展示了Store.safe_attrs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __str__

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import safe_attrs [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

示例2: __str__

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import safe_attrs [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

示例3: JSON

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import safe_attrs [as 别名]
    def JSON(self, includemap=None, excludemap=None):
        '''Output this object according to JSON rules. We take advantage
        of the fact that Neo4j restricts what kind of objects we can
        have as Node properties.
        '''

        attrstodump = []
        for attr in Store.safe_attrs(self):
            if includemap is not None and attr not in includemap:
                continue
            if excludemap is not None and attr in excludemap:
                continue
            attrstodump.append(attr)
        ret = '{'
        comma = ''
        for attr in attrstodump.sort():
            ret += '%s"%s": %s' % (comma, attr, GraphNode._JSONelem(getattr(self, attr)))
            comma = ','
        ret += '}'
        return ret
开发者ID:borgified,项目名称:testroot,代码行数:22,代码来源:graphnodes.py


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