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


Python OIBTree.OIBTree类代码示例

本文整理汇总了Python中BTrees.OIBTree.OIBTree的典型用法代码示例。如果您正苦于以下问题:Python OIBTree类的具体用法?Python OIBTree怎么用?Python OIBTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: clear

 def clear(self):
     self._nextid      = BTrees.Length.Length()
     self._forward_idx = OIBTree()
     self._inverse_idx = IOBTree()
     if self.truncate_left:
         self._lforward_idx = OIBTree()
     else:
         self._lforward_idx = None
开发者ID:eaudeweb,项目名称:naaya,代码行数:8,代码来源:StandardLexicon.py

示例2: __init__

    def __init__(self):
        # These keep track of symbolic label and branch names that
        # have been used to ensure that they don't collide.
        self._branches = OIBTree()
        self._branches['mainline'] = 1
        self._labels = OIBTree()

        self._histories = OOBTree()
        self._created = time.time()
开发者ID:jean,项目名称:Products.ZopeVersionControl,代码行数:9,代码来源:Repository.py

示例3: __init__

    def __init__(self):
        super(ContentTypeScopeManager, self).__init__()
        self._mappings = IOBTree()

        # Methods permitted to access this mapping with.  Originally
        # I wanted to provide alternative sets of mapping on a per
        # mapping_id basis, however this proved to be complex and
        # complicated due to extra relationships involved.
        self._methods = IOBTree()

        # For metadata related to the above.
        self._mappings_metadata = IOBTree()

        # To ease the usage of scopes, the mappings are referenced by
        # names and are called profiles which add a few useful fields to
        # allow slightly easier usage.  This separates the name from the
        # already active tokens such that once a token is instantiated
        # with a scope, the mapping is stuck until the token is revoked.
        self._named_mappings = OIBTree()  # name to id.

        # To not overburden the named mappings with work-in-progress
        # profiles, instantiate one here also.
        self._edit_mappings = OOBTree()

        self.default_mapping_id = self.addMapping({})
开发者ID:PMR2,项目名称:pmr2.oauth,代码行数:25,代码来源:scope.py

示例4: clear

 def clear(self):
     """Empty the lexicon.
     """
     self.length = Length()
     self._wid_length_based = False
     self._wids = OIBTree()  # word -> wid
     self._words = IOBTree()  # wid -> word
开发者ID:zopefoundation,项目名称:Products.ZCatalog,代码行数:7,代码来源:Lexicon.py

示例5: _clear_and_rebuild

    def _clear_and_rebuild(self, ids=[]):
        """
        """
        self._positionId = IOBTree()
        self._idPosition = OIBTree()

        for id in ids:
            self.addObject(id)
开发者ID:rochecompaan,项目名称:Products.UpfrontAccounting,代码行数:8,代码来源:OrderedBTreeContainer.py

示例6: clear

 def clear(self):
     self._length = Length()
     self._index = OIBTree()
     self._unindex = IOBTree()
     if self._counter is None:
         self._counter = Length()
     else:
         self._increment_counter()
开发者ID:eprigorodov,项目名称:Products.ZCatalog,代码行数:8,代码来源:UUIDIndex.py

示例7: DateIndex

class DateIndex(UnIndex):
    """ Index for Dates """

    __implements__ = (PluggableIndex.PluggableIndexInterface,)

    meta_type = 'DateIndex'
    query_options = ['query', 'range']

    manage = manage_main = DTMLFile( 'dtml/manageDateIndex', globals() )
    manage_main._setName( 'manage_main' )
    manage_options = ( { 'label' : 'Settings'
                       , 'action' : 'manage_main'
                       },
                     )

    def clear( self ):
        """ Complete reset """
        self._index = IOBTree()
        self._unindex = OIBTree()


    def index_object( self, documentId, obj, threshold=None ):
        """index an object, normalizing the indexed value to an integer

           o Normalized value has granularity of one minute.

           o Objects which have 'None' as indexed value are *omitted*,
             by design.
        """
        returnStatus = 0

        try:
            date_attr = getattr( obj, self.id )
            if callable( date_attr ):
                date_attr = date_attr()

            ConvertedDate = self._convert( value=date_attr, default=_marker )
        except AttributeError:
            ConvertedDate = _marker

        oldConvertedDate = self._unindex.get( documentId, _marker )

        if ConvertedDate != oldConvertedDate:
            if oldConvertedDate is not _marker:
                self.removeForwardIndexEntry(oldConvertedDate, documentId)

            if ConvertedDate is not _marker:
                self.insertForwardIndexEntry( ConvertedDate, documentId )
                self._unindex[documentId] = ConvertedDate

            returnStatus = 1

        return returnStatus


    def _apply_index( self, request, cid='', type=type, None=None ):
开发者ID:OS2World,项目名称:APP-SERVER-Zope,代码行数:56,代码来源:DateIndex.py

示例8: __init__

 def __init__(self, *pipeline):
     self._wids = OIBTree()  # word -> wid
     self._words = IOBTree() # wid -> word
     # wid 0 is reserved for words that aren't in the lexicon (OOV -- out
     # of vocabulary).  This can happen, e.g., if a query contains a word
     # we never saw before, and that isn't a known stopword (or otherwise
     # filtered out).  Returning a special wid value for OOV words is a
     # way to let clients know when an OOV word appears.
     self.wordCount = Length()
     self._pipeline = pipeline
开发者ID:zopefoundation,项目名称:zope.index,代码行数:10,代码来源:lexicon.py

示例9: clear

    def clear(self):
        """ clear catalog """

        self.data = IOBTree()  # mapping of rid to meta_data
        self.uids = OIBTree()  # mapping of uid to rid
        self.paths = IOBTree()  # mapping of rid to uid
        self._length = BTrees.Length.Length()

        for index in self.indexes.keys():
            self.getIndex(index).clear()
开发者ID:wildcardcorp,项目名称:Products.ZCatalog,代码行数:10,代码来源:Catalog.py

示例10: reset

    def reset(self):
        """Forget everything; usually called from __init__.
        """
        String.reset(self)

        self.path2rid = OIBTree()   # {path:rid}
        self.rid2path = IOBTree()   # {rid:path}
        self.parts = OOBTree()      # {(level,part):rids}
        self.rids = IOBTree()       # {rid:(level,part)s}
        self.levels = IOBTree()     # {level:rids}
开发者ID:Pythoning,项目名称:dewey,代码行数:10,代码来源:indices.py

示例11: clear

    def clear(self):
        """ clear catalog """

        self.data  = IOBTree()  # mapping of rid to meta_data
        self.uids  = OIBTree()  # mapping of uid to rid
        self.paths = IOBTree()  # mapping of rid to uid

        # convert old-style Catalog object to new in-place
        try: self.__len__.set(0)
        except AttributeError: self.__len__=BTrees.Length.Length()

        for index in self.indexes.keys():
            self.getIndex(index).clear()
开发者ID:OS2World,项目名称:APP-SERVER-Zope,代码行数:13,代码来源:Catalog.py

示例12: clear

    def clear(self):
        """Empty the index"""
        
        IOBTree = BTrees.family64.IO.BTree

        self._index = IOBTree() # {rangeid: [document_id, ...]}
        self._unindex = IOBTree() # {document_id: [rangeid, ...]}
        self._range_mapping = IOBTree() # {rangeid: range}
        self._reverse_range_mapping = OIBTree() # {range: rangeid}
        self._since_index = IOBTree() # {since: [rangeid,...]}
        self._until_index = IOBTree() # {until: [rangeid,...]}
        self._length = BTrees.Length.Length()
        self._unique_values_length = BTrees.Length.Length()
开发者ID:davidgillies,项目名称:silva.app.news,代码行数:13,代码来源:indexing.py

示例13: __init__

    def __init__(self, *pipeline):
        self._wids = OIBTree()  # word -> wid
        self._words = IOBTree() # wid -> word
        # wid 0 is reserved for words that aren't in the lexicon (OOV -- out
        # of vocabulary).  This can happen, e.g., if a query contains a word
        # we never saw before, and that isn't a known stopword (or otherwise
        # filtered out).  Returning a special wid value for OOV words is a
        # way to let clients know when an OOV word appears.
        self._nextwid = 1
        self._pipeline = pipeline

        # Keep some statistics about indexing
        self._nbytes = 0 # Number of bytes indexed (at start of pipeline)
        self._nwords = 0 # Number of words indexed (after pipeline)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例14: MessageService

class MessageService(Persistent, Location):
    interface.implements(IMessageService)

    def __init__(self, storage):
        self.__parent__ = storage

        self.index = OIBTree()
        self.unread = Length(0)

    def __len__(self):
        return len(self.index)

    def __iter__(self):
        return iter(self.index.values())

    def __contains__(self, key):
        msg = self.__parent__.getMessage(key)
        if msg is not None:
            return True
        else:
            return False

    def get(self, msgId, default=None):
        msg = self.__parent__.getMessage(msgId)
        if msg is not None:
            if msg.__date__ in self.index:
                return msg

        return default

    def append(self, message):
        message.__parent__ = self

        if self.__parent__.readStatus(message):
            self.unread.change(1)

        self.index[message.__date__] = message.__id__

    def remove(self, message):
        id = message.__date__

        if id in self.index:
            del self.index[id]

            if self.__parent__.readStatus(message) and self.unread() > 0:
                self.unread.change(-1)

    def create(self, **data):
        raise NotImplemented('create')
开发者ID:Zojax,项目名称:zojax.messaging,代码行数:49,代码来源:service.py

示例15: Ballots

class Ballots(object):
    """ Simple object to help counting votes. It's not addable anywhere.
        Should be treated as an internal object for polls.
    """

    def __init__(self):
        """ Ballots attr is an OIBTree, since they can have any object as key.
        """
        self.ballots = OIBTree()

    def result(self):
        """ Return a tuple with sorted ballot items. """
        return tuple( sorted( self.ballots.iteritems() ) )

    def add(self, value):
        """ Add a dict of results - a ballot - to the pool. Append and increase counter. """
        if value in self.ballots:
            self.ballots[value] += 1
        else:
            self.ballots[value] = 1
开发者ID:,项目名称:,代码行数:20,代码来源:


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