Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(235)  |  Call(158)  |  Derive(0)  |  Import(77)
BTree lengths are often too expensive to compute.

Objects that use BTrees need to keep track of lengths themselves.
This class provides an object for doing this.

As a bonus, the object support application-level conflict
resolution.

It is tempting to to assign length objects to __len__ attributes
to provide instance-specific __len__ methods.  However, this no(more...)

src/p/r/Products.ZCatalog-3.0.2/src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py   Products.ZCatalog(Download)
    def clear(self):
        self._index = IITreeSet()
        self._index_length = BTrees.Length.Length()
        self._index_value = 1
        self._unindex = IIBTree()
        self._length = BTrees.Length.Length()
            self._index.remove(documentId)
            length -= 1
        self._index_length = BTrees.Length.Length(length)
 
    def _inline_migration(self):
        self._length = BTrees.Length.Length(len(self._unindex.keys()))
        self._index_length = BTrees.Length.Length(len(self._index))

src/z/o/zope.index-4.0.1/src/zope/index/text/baseindex.py   zope.index(Download)
 
        # Use a BTree length for efficient length computation w/o conflicts
        self.wordCount = Length.Length()
        self.documentCount = Length.Length()
 
        except AttributeError:
            # upgrade documentCount to Length object
            self.documentCount = Length.Length(len(self._docweight))
        return len(wids)
 
        except AttributeError:
            # upgrade documentCount to Length object
            self.documentCount = Length.Length(len(self._docweight))
 
    def search(self, term):
            except AttributeError:
                # upgrade wordCount to Length object
                self.wordCount = Length.Length(len(self._wordinfo))
                self.wordCount.change(1)
        else:

src/c/o/contentratings-1.1/contentratings/storage.py   contentratings(Download)
from BTrees.OOBTree import OOBTree
from BTrees.IOBTree import IOBTree
from BTrees.Length import Length
from contentratings.rating import Rating
from contentratings.interfaces import (
        self._ratings = OOBTree()
        self._sessions = OOBTree()
        self._length = Length()
        self._anon_length = Length()
 
    def _anon_count(self):
        # Dynamic Migration
        if self._anon_length is None:
            self._anon_length = Length(len(self._anon_ratings))
        return self._anon_length()

src/p/l/plone.app.upgrade-1.3.6/plone/app/upgrade/v41/alphas.py   plone.app.upgrade(Download)
from BTrees.IIBTree import IITreeSet
from BTrees.OIBTree import OIBTree
from BTrees.Length import Length
from Products.CMFCore.utils import getToolByName
from Products.GenericSetup.rolemap import RolemapExportConfigurator
    false_length = len(sets[0])
    true_length = len(sets[1])
    index._length = Length(false_length + true_length)
    # we put the smaller set into the index
    if false_length < true_length:
        index._index_value = 0
        index._index_length = Length(false_length)
    else:
        index._index_value = 1
        index._index_length = Length(true_length)
        index._index = sets[1]
        del sets[0]

src/h/y/hypatia-0.1/hypatia/text/baseindex.py   hypatia(Download)
 
        # Use a BTree length for efficient length computation w/o conflicts
        self.word_count = Length.Length()
        self.indexed_count = Length.Length()
 
        except AttributeError:
            # upgrade indexed_count to Length object
            self.indexed_count = Length.Length(len(self._docweight))
        return len(wids)
 
        except AttributeError:
            # upgrade indexed_count to Length object
            self.indexed_count = Length.Length(len(self._docweight))
 
    def search(self, term):
            except AttributeError:
                # upgrade word_count to Length object
                self.word_count = Length.Length(len(self._wordinfo))
                self.word_count.change(1)
        else:

src/p/r/Products.ZCTextIndex-2.13.5/src/Products/ZCTextIndex/BaseIndex.py   Products.ZCTextIndex(Download)
from BTrees.IIBTree import difference
from BTrees.IIBTree import intersection
from BTrees.Length import Length
from Persistence import Persistent
from zope.interface import implements
 
        # Use a BTree length for efficient length computation w/o conflicts
        self.length = Length()
        self.document_count = Length()
 
        except AttributeError:
            # Upgrade document_count to Length object
            self.document_count = Length(self.document_count())
        return len(wids)
 

src/z/o/zope.index-4.0.1/src/zope/index/text/lexicon.py   zope.index(Download)
from BTrees.IOBTree import IOBTree
from BTrees.OIBTree import OIBTree
from BTrees.Length import Length
 
from persistent import Persistent
        # 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
 
        if not isinstance(self.wordCount, Length):
            # Make sure wordCount is overridden with a BTrees.Length.Length
            self.wordCount = Length(self.wordCount())
        # Strategically unload the length value so that we get the most
        # recent value written to the database to minimize conflicting wids

src/p/l/plone.app.upgrade-HEAD/plone/app/upgrade/v41/alphas.py   plone.app.upgrade(Download)
from BTrees.IIBTree import IITreeSet
from BTrees.OIBTree import OIBTree
from BTrees.Length import Length
from Products.CMFCore.utils import getToolByName
from Products.GenericSetup.rolemap import RolemapExportConfigurator
    false_length = len(sets[0])
    true_length = len(sets[1])
    index._length = Length(false_length + true_length)
    # we put the smaller set into the index
    if false_length < true_length:
        index._index_value = 0
        index._index_length = Length(false_length)
    else:
        index._index_value = 1
        index._index_length = Length(true_length)
        index._index = sets[1]
        del sets[0]

src/h/y/hypatia-HEAD/hypatia/text/baseindex.py   hypatia(Download)
 
        # Use a BTree length for efficient length computation w/o conflicts
        self.word_count = Length.Length()
        self.indexed_count = Length.Length()
 
        except AttributeError:
            # upgrade indexed_count to Length object
            self.indexed_count = Length.Length(len(self._docweight))
        return len(wids)
 
        except AttributeError:
            # upgrade indexed_count to Length object
            self.indexed_count = Length.Length(len(self._docweight))
 
    def search(self, term):
            except AttributeError:
                # upgrade word_count to Length object
                self.word_count = Length.Length(len(self._wordinfo))
                self.word_count.change(1)
        else:

src/i/n/indico-HEAD/indico/MaKaC/plugins/Collaboration/Vidyo/indexes.py   indico(Download)
from BTrees import LOBTree, OOBTree
from MaKaC.common.timezoneUtils import datetimeToUnixTimeInt, unixTimeToDatetime
from BTrees.Length import Length
from MaKaC.common.logger import Logger
from MaKaC.conference import ConferenceHolder
    def __init__(self):
        self._tree = LOBTree.LOBTree()
        self._count = Length(0)
 
    ## private class methods ##
    def clear(self):
        """ Clears all the information stored
        """
        self._tree = LOBTree.LOBTree()
        self._count = Length(0)
    def __init__(self):
        self._bookings = OOBTree.OOTreeSet()
        self._count = Length(0)
 
    def addBooking(self, booking):

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next