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

All Samples(28)  |  Call(16)  |  Derive(0)  |  Import(12)
Check internal value-based invariants in a BTree or TreeSet.

The btree._check() method checks internal C-level pointer consistency.
The check() function here checks value-based invariants:  whether the
keys in leaf bucket and internal nodes are in strictly increasing order,
and whether they all lie in their expected range.  The latter is a subtle
invariant that can't be checked locally -- it requires propagating
range info down from the root of the tree, and modifying it at each
level for each child.
(more...)

        def check(btree):
    """Check internal value-based invariants in a BTree or TreeSet.

    The btree._check() method checks internal C-level pointer consistency.
    The check() function here checks value-based invariants:  whether the
    keys in leaf bucket and internal nodes are in strictly increasing order,
    and whether they all lie in their expected range.  The latter is a subtle
    invariant that can't be checked locally -- it requires propagating
    range info down from the root of the tree, and modifying it at each
    level for each child.

    Raises AssertionError if anything is wrong, with a string detail
    explaining the problems.  The entire tree is checked before
    AssertionError is raised, and the string detail may be large (depending
    on how much went wrong).
    """

    Checker(btree).check()
        


src/e/r/erp5-HEAD/product/ERP5Type/patches/BTreeFolder2.py   erp5(Download)
    detected and fixed.
    """
    from BTrees.check import check
    path = '/'.join(self.getPhysicalPath())
    try:
        check(self._tree)
                raise AssertionError(
                    "Missing value for key: %s" % repr(key))
        check(self._mt_index)
        for key, object in self._tree.items():
            meta_type = getattr(object, 'meta_type', None)
                    "Missing or incorrect meta_type index: %s"
                    % repr(key))
            check(value)
            for k in value.keys():
                if not value.has_key(k) or not self._tree.has_key(k):

src/p/r/Products.BTreeFolder2-2.13.4/src/Products/BTreeFolder2/BTreeFolder2.py   Products.BTreeFolder2(Download)
        detected and fixed.
        """
        from BTrees.check import check
        path = '/'.join(self.getPhysicalPath())
        try:
            check(self._tree)
                    raise AssertionError(
                        "Missing value for key: %s" % repr(key))
            check(self._mt_index)
            for key, value in self._mt_index.items():
                if (key not in self._mt_index
                    or self._mt_index[key] is not value):
                    raise AssertionError(
                        "Missing or incorrect meta_type index: %s"
                        % repr(key))
                check(value)

src/e/r/erp5-HEAD/product/HBTreeFolder2/HBTreeFolder2.py   erp5(Download)
        def hCheck(htree):
          """
              Recursively check the btree
          """
          check(htree)
          return 1
 
        from BTrees.check import check
        path = '/'.join(self.getPhysicalPath())
        try:

src/c/o/collective.recipe.zope2wsgi-0.1/collective/recipe/zope2wsgi/utilities/ZODBTools/checkbtrees.py   collective.recipe.zope2wsgi(Download)
import ZODB
from ZODB.FileStorage import FileStorage
from BTrees.check import check
 
# Set of oids we've already visited.  Since the object structure is
 
                try:
                    check(obj)
                except AssertionError, msg:
                    print "*" * 60

src/z/o/ZODB-4.0.0/src/ZODB/scripts/checkbtrees.py   ZODB(Download)
import ZODB
from ZODB.FileStorage import FileStorage
from BTrees.check import check
 
# Set of oids we've already visited.  Since the object structure is
 
                try:
                    check(obj)
                except AssertionError as msg:
                    print("*" * 60)

src/c/o/collective.forgetit-0.0.1/src/collective/forgetit/views.py   collective.forgetit(Download)
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
from BTrees.check import check
from pickle import dumps, PicklingError
    def is_ordered(self, item):
        if item is None:
            return True
        try:
            check(item)

src/z/o/ZODB-HEAD/src/ZODB/scripts/checkbtrees.py   ZODB(Download)
import ZODB
from ZODB.FileStorage import FileStorage
from BTrees.check import check
 
# Set of oids we've already visited.  Since the object structure is
 
                try:
                    check(obj)
                except AssertionError as msg:
                    print("*" * 60)

src/b/t/BTrees-4.0.8/BTrees/tests/test_check.py   BTrees(Download)
    def _callFUT(self, tree):
        from BTrees.check import check
        return check(tree)
 
    def _makeOne(self):

src/b/t/BTrees-4.0.8/BTrees/tests/testBTrees.py   BTrees(Download)
    def _build_degenerate_tree(self):
        # Build the buckets and chain them together.
        from BTrees.IIBTree import IISet
        from BTrees.IIBTree import IITreeSet
        from BTrees.check import check
        t.__setstate__(((tree13, 4, tree5711), bucket1))
        t._check()
        check(t)
        return t, [1, 3, 5, 7, 11]
 
        #    warnings, possibly due to memory corruption after a BTree
        #    goes insane.
        from BTrees.check import check
        t, keys = self._build_degenerate_tree()
        for oneperm in permutations(keys):
                keys.remove(key)
                t._check()
                check(t)
                self._checkRanges(t, keys)
            # We removed all the keys, so the tree should be empty now.

src/b/t/BTrees-4.0.8/BTrees/tests/common.py   BTrees(Download)
    def _checkIt(self, t):
        from BTrees.check import check
        t._check()
        check(t)
 

  1 | 2  Next