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


Python OrderedDict.get方法代码示例

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


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

示例1: TableAnnotation

# 需要导入模块: from sqlalchemy.util import OrderedDict [as 别名]
# 或者: from sqlalchemy.util.OrderedDict import get [as 别名]
class TableAnnotation( object ):
    """
    Annotations for Table objects, to annotate as needed, the notion
    is that the annotation keys correspond to column, and values correspond
    to application specific column metadata.
    """

    _marker = object()
    schema_invariants = ()
    
    def __init__(self, table_name, columns=(), properties=(), schema_order=(), listing_columns=(), order_by=()):
        self.table_name = table_name
        self._options = {}
        self._annot = OrderedDict()

        for info in columns:
            self._annot[ info['name'] ] = info

        self.properties = properties
        self.schema_order = schema_order        
        self.listing_columns = listing_columns
        self.order_by = order_by

    def setOption( self, name, value ):
        self._options[ name ] = value
        
    def getOption( self, name, default=None ):
        return self._options.get( name, default )

    def __call__( self, iface ):
        return self
    
    def __setitem__(self, name, value ):
        self._annot[name] = value

    def get( self, name, default=None ):
        return self._annot.get( name, default )

    def __getitem__(self, name):
        return self.get( name )

    def values( self ):
        return self._annot.values()

    def __contains__(self, name ):
        return not self._marker == self.get( name, self._marker )
开发者ID:BGCX261,项目名称:zope-alchemist-svn-to-git,代码行数:48,代码来源:sa2zs.py

示例2: TableAnnotation

# 需要导入模块: from sqlalchemy.util import OrderedDict [as 别名]
# 或者: from sqlalchemy.util.OrderedDict import get [as 别名]
class TableAnnotation( object ):

    #__slots__ = ("table_name", "_annot", "_options")

    def __init__(self, table_name, columns=(), properties=(), schema_order=(), table_columns=(), order_by=()):
        self.table_name = table_name
        self._options = {}
        self._annot = OrderedDict()

        for info in columns:
            self._annot[ info['name'] ] = info

        self.properties = properties
        self.schema_order = schema_order        
        self.table_columns = table_columns
        self.order_by = order_by

    def setOption( self, name, value ):
        self._options[ name ] = value
        
    def getOption( self, name, default=None ):
        return self._options.get( name, default )
    
    def __call__( self, context ):
        return ModelAnnotation( context, self )

    def __setitem__(self, name, value ):
        self._annot[name] = value

    def get( self, name, default=None ):
        return self._annot.get( name, default )

    def __getitem__(self, anme):
        return self.get( name )

    def values( self ):
        return self._annot.values()

    def __contains__(self, name ):
        marker = object()
        return not marker == self.get( name, marker )
开发者ID:BGCX261,项目名称:zope-alchemist-svn-to-git,代码行数:43,代码来源:annotation.py


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