Commit 9313ee68 authored by Julien Muchembled's avatar Julien Muchembled

import python-btrees_4.3.1.orig.tar.gz

parents
[report]
exclude_lines =
# pragma: no cover
class I[A-Z]\w+\((Interface|I[A-Z].*)\):
bin
eggs
develop-eggs
parts
.installed.cfg
build
docs/_build
__pycache__
*.pyc
*.so
.tox
.coverage
nosetests.xml
coverage.xml
*.egg-info
*.egg
dist
.eggs/
.dir-locals.el
language: python
sudo: false
matrix:
include:
- os: linux
python: 2.7
- os: linux
python: 3.3
- os: linux
python: 3.4
- os: linux
python: 3.5
- os: linux
python: pypy
- os: linux
python: pypy3
- os: osx
language: generic
env: TERRYFY_PYTHON='homebrew 2'
- os: osx
language: generic
env: TERRYFY_PYTHON='homebrew 3'
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git clone https://github.com/MacPython/terryfy; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source terryfy/travis_tools.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then get_python_environment $TERRYFY_PYTHON venv; fi
- if [[ "$TERRYFY_PYTHON" == "homebrew 3" ]]; then alias pip=`which pip3` ; fi
install:
- pip install -e .[ZODB]
script:
- python setup.py -q test -q
notifications:
email: false
after_success:
- echo [distutils] > ~/.pypirc
- echo index-servers = pypi >> ~/.pypirc
- echo [pypi] >> ~/.pypirc
- echo repository=https://pypi.python.org/pypi >> ~/.pypirc
- echo username=zope.wheelbuilder >> ~/.pypirc
- echo password=$PYPIPASSWORD >> ~/.pypirc
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then pip install twine; fi
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then python setup.py bdist_wheel; fi
- if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then twine upload dist/*; fi
env:
global:
secure: "CpYDbVb6YOyIAnCcvBEiDLeYmNhfDDqJosIV0NussN9dNe1hsfHQK98evAEe9F4kXuWo6SmmtT0uX2RXOojB5If/z7sAcXSDaGWCMJK0FY98sWL2DCRtb1/O1puo/uvn3RJlpe4bkxQoyFCKjpWaTJOM+NSEt7YbTTTdCpG7/zU="
Metadata-Version: 1.1
Name: BTrees
Version: 4.3.1
Summary: Scalable persistent object containers
Home-page: http://packages.python.org/BTrees
Author: Zope Foundation
Author-email: zodb-dev@zope.org
License: ZPL 2.1
Description: ``BTrees``: scalable persistent components
===========================================
.. image:: https://travis-ci.org/zopefoundation/BTrees.svg?branch=master
:target: https://travis-ci.org/zopefoundation/BTrees
.. image:: https://ci.appveyor.com/api/projects/status/github/zopefoundation/BTrees?branch=master&svg=true
:target: https://ci.appveyor.com/project/mgedmin/BTrees
This package contains a set of persistent object containers built around
a modified BTree data structure. The trees are optimized for use inside
ZODB's "optimistic concurrency" paradigm, and include explicit resolution
of conflicts detected by that mechannism.
Please see the Sphinx documentation (``docs/index.rst``) for further
information.
``BTrees`` Changelog
====================
4.3.1 (2016-05-16)
------------------
- Packaging: fix password used to automate wheel creation on Travis.
4.3.0 (2016-05-10)
------------------
- Fix unexpected ``OverflowError`` when passing 64bit values to long
keys / values on Win64. See:
https://github.com/zopefoundation/BTrees/issues/32
- When testing ``PURE_PYTHON`` environments under ``tox``, avoid poisoning
the user's global wheel cache.
- Ensure that he pure-Python implementation, used on PyPy and when a C
compiler isn't available for CPython, pickles identically to the C
version. Unpickling will choose the best available implementation.
This change prevents interoperability problems and database corruption if
both implementations are in use. While it is no longer possible to
pickle a Python implementation and have it unpickle to the Python
implementation if the C implementation is available, existing Python
pickles will still unpickle to the Python implementation (until
pickled again). See:
https://github.com/zopefoundation/BTrees/issues/19
- Avoid creating invalid objects when unpickling empty BTrees in a pure-Python
environment.
- Drop support for Python 2.6 and 3.2.
4.2.0 (2015-11-13)
------------------
- Add support for Python 3.5.
4.1.4 (2015-06-02)
------------------
- Ensure that pure-Python Bucket and Set objects have a human readable
``__repr__`` like the C versions.
4.1.3 (2015-05-19)
------------------
- Fix ``_p_changed`` when removing items from small pure-Python
BTrees/TreeSets and when adding items to small pure-Python Sets. See:
https://github.com/zopefoundation/BTrees/issues/13
4.1.2 (2015-04-07)
------------------
- Suppress testing 64-bit values in OLBTrees on 32 bit machines.
See: https://github.com/zopefoundation/BTrees/issues/9
- Fix ``_p_changed`` when adding items to small pure-Python
BTrees/TreeSets. See:
https://github.com/zopefoundation/BTrees/issues/11
4.1.1 (2014-12-27)
------------------
- Accomodate long values in pure-Python OLBTrees.
4.1.0 (2014-12-26)
------------------
- Add support for PyPy and PyPy3.
- Add support for Python 3.4.
- BTree subclasses can define ``max_leaf_size`` or ``max_internal_size``
to control maximum sizes for Bucket/Set and BTree/TreeSet nodes.
- Detect integer overflow on 32-bit machines correctly under Python 3.
- Update pure-Python and C trees / sets to accept explicit None to indicate
max / min value for ``minKey``, ``maxKey``. (PR #3)
- Update pure-Python trees / sets to accept explicit None to indicate
open ranges for ``keys``, ``values``, ``items``. (PR #3)
4.0.8 (2013-05-25)
------------------
- Fix value-based comparison for objects under Py3k: addresses invalid
merges of ``[OLI]OBTrees/OBuckets``.
- Ensure that pure-Python implementation of ``OOBTree.byValue`` matches
semantics (reversed-sort) of C implementation.
4.0.7 (2013-05-22)
------------------
- Issue #2: compilation error on 32-bit mode of OS/X.
- Test ``PURE_PYTHON`` environment variable support: if set, the C
extensions will not be built, imported, or tested.
4.0.6 (2013-05-14)
------------------
- Changed the ``ZODB`` extra to require only the real ``ZODB`` package,
rather than the ``ZODB3`` metapackage: depending on the version used,
the metapackage could pull in stale versions of **this** package and
``persistent``.
- Fixed Python version check in ``setup.py``.
4.0.5 (2013-01-15)
------------------
- Fit the ``repr`` of bucket objects, which could contain garbage
characters.
4.0.4 (2013-01-12)
------------------
- Emulate the (private) iterators used by the C extension modules from
pure Python. This change is "cosmetic" only: it prevents the ZCML
``zope.app.security:permission.zcml`` from failing. The emulated
classes are **not** functional, and should be considered implementation
details.
- Accomodate buildout to the fact that we no longer bundle a copy
of 'persistent.h'.
- Fix test failures on Windows: no longer rely on overflows from
``sys.maxint``.
4.0.3 (2013-01-04)
------------------
- Added ``setup_requires==['persistent']``.
4.0.2 (2013-01-03)
------------------
- Updated Trove classifiers.
- Added explicit support for Python 3.2, Python 3.3, and PyPy.
Note that the C extensions are not (yet) available on PyPy.
- Python reference implementations now tested separately from the C
verions on all platforms.
- 100% unit test coverage.
4.0.1 (2012-10-21)
------------------
- Provide local fallback for persistent C header inclusion if the
persistent distribution isn't installed. This makes the winbot happy.
4.0.0 (2012-10-20)
------------------
Platform Changes
################
- Dropped support for Python < 2.6.
- Factored ``BTrees`` as a separate distribution.
Testing Changes
###############
- All covered platforms tested under ``tox``.
- Added support for continuous integration using ``tox`` and ``jenkins``.
- Added ``setup.py dev`` alias (installs ``nose`` and ``coverage``).
- Dropped dependency on ``zope.testing`` / ``zope.testrunner``: tests now
run with ``setup.py test``.
Documentation Changes
#####################
- Added API reference, generated via Spinx' autodoc.
- Added Sphinx documentation based on ZODB Guide (snippets are exercised
via 'tox').
- Added ``setup.py docs`` alias (installs ``Sphinx`` and
``repoze.sphinx.autointerface``).
Platform: any
Classifier: Development Status :: 6 - Mature
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: ZODB
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
.coveragerc
.gitignore
.travis.yml
CHANGES.rst
COPYRIGHT.txt
LICENSE.txt
MANIFEST.in
README.rst
appveyor.yml
bootstrap.py
buildout.cfg
setup.cfg
setup.py
tox.ini
BTrees/BTreeItemsTemplate.c
BTrees/BTreeModuleTemplate.c
BTrees/BTreeTemplate.c
BTrees/BucketTemplate.c
BTrees/Development.txt
BTrees/IFBTree.py
BTrees/IIBTree.py
BTrees/IOBTree.py
BTrees/Interfaces.py
BTrees/LFBTree.py
BTrees/LLBTree.py
BTrees/LOBTree.py
BTrees/Length.py
BTrees/MergeTemplate.c
BTrees/OIBTree.py
BTrees/OLBTree.py
BTrees/OOBTree.py
BTrees/SetOpTemplate.c
BTrees/SetTemplate.c
BTrees/TreeSetTemplate.c
BTrees/_IFBTree.c
BTrees/_IIBTree.c
BTrees/_IOBTree.c
BTrees/_LFBTree.c
BTrees/_LLBTree.c
BTrees/_LOBTree.c
BTrees/_OIBTree.c
BTrees/_OLBTree.c
BTrees/_OOBTree.c
BTrees/__init__.py
BTrees/_base.py
BTrees/_compat.h
BTrees/_compat.py
BTrees/_fsBTree.c
BTrees/check.py
BTrees/floatvaluemacros.h
BTrees/fsBTree.py
BTrees/intkeymacros.h
BTrees/intvaluemacros.h
BTrees/nosetests.xml
BTrees/objectkeymacros.h
BTrees/objectvaluemacros.h
BTrees/sorters.c
BTrees/utils.py
BTrees.egg-info/PKG-INFO
BTrees.egg-info/SOURCES.txt
BTrees.egg-info/dependency_links.txt
BTrees.egg-info/entry_points.txt
BTrees.egg-info/not-zip-safe
BTrees.egg-info/requires.txt
BTrees.egg-info/top_level.txt
BTrees/tests/__init__.py
BTrees/tests/common.py
BTrees/tests/testBTrees.py
BTrees/tests/testBTreesUnicode.py
BTrees/tests/testConflict.py
BTrees/tests/test_IFBTree.py
BTrees/tests/test_IIBTree.py
BTrees/tests/test_IOBTree.py
BTrees/tests/test_LFBTree.py
BTrees/tests/test_LLBTree.py
BTrees/tests/test_LOBTree.py
BTrees/tests/test_Length.py
BTrees/tests/test_OIBTree.py
BTrees/tests/test_OLBTree.py
BTrees/tests/test_OOBTree.py
BTrees/tests/test__base.py
BTrees/tests/test_btreesubclass.py
BTrees/tests/test_check.py
BTrees/tests/test_fsBTree.py
BTrees/tests/test_utils.py
docs/Makefile
docs/api.rst
docs/conf.py
docs/index.rst
docs/make.bat
docs/_static/placeholder.txt
docs/_templates/placeholder.txt
\ No newline at end of file
\ No newline at end of file
persistent
zope.interface
[ZODB]
ZODB
[docs]
Sphinx
repoze.sphinx.autointerface
[test]
persistent
zope.interface
transaction
[testing]
persistent
zope.interface
transaction
nose
coverage
/*****************************************************************************
Copyright (c) 2001, 2002 Zope Foundation and Contributors.
All Rights Reserved.
This software is subject to the provisions of the Zope Public License,
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE
****************************************************************************/
#define BTREEITEMSTEMPLATE_C "$Id$\n"
/* A BTreeItems struct is returned from calling .items(), .keys() or
* .values() on a BTree-based data structure, and is also the result of
* taking slices of those. It represents a contiguous slice of a BTree.
*
* The start of the slice is in firstbucket, at offset first. The end of
* the slice is in lastbucket, at offset last. Both endpoints are inclusive.
* It must possible to get from firstbucket to lastbucket via following
* bucket 'next' pointers zero or more times. firstbucket, first, lastbucket,
* and last are readonly after initialization. An empty slice is represented
* by firstbucket == lastbucket == currentbucket == NULL.
*
* 'kind' determines whether this slice represents 'k'eys alone, 'v'alues
* alone, or 'i'items (key+value pairs). 'kind' is also readonly after
* initialization.
*
* The combination of currentbucket, currentoffset and pseudoindex acts as
* a search finger. Offset currentoffset in bucket currentbucket is at index
* pseudoindex, where pseudoindex==0 corresponds to offset first in bucket
* firstbucket, and pseudoindex==-1 corresponds to offset last in bucket
* lastbucket. The function BTreeItems_seek() can be used to set this combo
* correctly for any in-bounds index, and uses this combo on input to avoid
* needing to search from the start (or end) on each call. Calling
* BTreeItems_seek() with consecutive larger positions is very efficent.
* Calling it with consecutive smaller positions is more efficient than if
* a search finger weren't being used at all, but is still quadratic time
* in the number of buckets in the slice.
*/
typedef struct
{
PyObject_HEAD
Bucket *firstbucket; /* First bucket */
Bucket *currentbucket; /* Current bucket (search finger) */
Bucket *lastbucket; /* Last bucket */
int currentoffset; /* Offset in currentbucket */
int pseudoindex; /* search finger index */
int first; /* Start offset in firstbucket */
int last; /* End offset in lastbucket */
char kind; /* 'k', 'v', 'i' */
} BTreeItems;
#define ITEMS(O)((BTreeItems*)(O))
static PyObject *
newBTreeItems(char kind,
Bucket *lowbucket, int lowoffset,
Bucket *highbucket, int highoffset);
static void
BTreeItems_dealloc(BTreeItems *self)
{
Py_XDECREF(self->firstbucket);
Py_XDECREF(self->lastbucket);
Py_XDECREF(self->currentbucket);
PyObject_DEL(self);
}
static Py_ssize_t
BTreeItems_length_or_nonzero(BTreeItems *self, int nonzero)
{
Py_ssize_t r;
Bucket *b, *next;
b = self->firstbucket;
if (b == NULL)
return 0;
r = self->last + 1 - self->first;
if (nonzero && r > 0)
/* Short-circuit if all we care about is nonempty */
return 1;
if (b == self->lastbucket)
return r;
Py_INCREF(b);
PER_USE_OR_RETURN(b, -1);
while ((next = b->next))
{
r += b->len;
if (nonzero && r > 0)
/* Short-circuit if all we care about is nonempty */
break;
if (next == self->lastbucket)
break; /* we already counted the last bucket */
Py_INCREF(next);
PER_UNUSE(b);
Py_DECREF(b);
b = next;
PER_USE_OR_RETURN(b, -1);
}
PER_UNUSE(b);
Py_DECREF(b);
return r >= 0 ? r : 0;
}
static Py_ssize_t
BTreeItems_length(BTreeItems *self)
{
return BTreeItems_length_or_nonzero(self, 0);
}
/*
** BTreeItems_seek
**
** Find the ith position in the BTreeItems.
**
** Arguments: self The BTree
** i the index to seek to, in 0 .. len(self)-1, or in
** -len(self) .. -1, as for indexing a Python sequence.
**
**
** Returns 0 if successful, -1 on failure to seek (like out-of-bounds).
** Upon successful return, index i is at offset self->currentoffset in bucket
** self->currentbucket.
*/
static int
BTreeItems_seek(BTreeItems *self, Py_ssize_t i)
{
int delta, pseudoindex, currentoffset;
Bucket *b, *currentbucket;
int error;
pseudoindex = self->pseudoindex;
currentoffset = self->currentoffset;
currentbucket = self->currentbucket;
if (currentbucket == NULL)
goto no_match;
delta = i - pseudoindex;
while (delta > 0) /* move right */
{
int max;
/* Want to move right delta positions; the most we can move right in
* this bucket is currentbucket->len - currentoffset - 1 positions.
*/
PER_USE_OR_RETURN(currentbucket, -1);
max = currentbucket->len - currentoffset - 1;
b = currentbucket->next;
PER_UNUSE(currentbucket);
if (delta <= max)
{
currentoffset += delta;
pseudoindex += delta;
if (currentbucket == self->lastbucket
&& currentoffset > self->last)
goto no_match;
break;
}
/* Move to start of next bucket. */
if (currentbucket == self->lastbucket || b == NULL)
goto no_match;
currentbucket = b;
pseudoindex += max + 1;
delta -= max + 1;
currentoffset = 0;
}
while (delta < 0) /* move left */
{
int status;
/* Want to move left -delta positions; the most we can move left in
* this bucket is currentoffset positions.
*/
if ((-delta) <= currentoffset)
{
currentoffset += delta;
pseudoindex += delta;
if (currentbucket == self->firstbucket
&& currentoffset < self->first)
goto no_match;
break;
}
/* Move to end of previous bucket. */
if (currentbucket == self->firstbucket)
goto no_match;
status = PreviousBucket(&currentbucket, self->firstbucket);
if (status == 0)
goto no_match;
else if (status < 0)
return -1;
pseudoindex -= currentoffset + 1;
delta += currentoffset + 1;
PER_USE_OR_RETURN(currentbucket, -1);
currentoffset = currentbucket->len - 1;
PER_UNUSE(currentbucket);
}
assert(pseudoindex == i);
/* Alas, the user may have mutated the bucket since the last time we
* were called, and if they deleted stuff, we may be pointing into
* trash memory now.
*/
PER_USE_OR_RETURN(currentbucket, -1);
error = currentoffset < 0 || currentoffset >= currentbucket->len;
PER_UNUSE(currentbucket);
if (error)
{
PyErr_SetString(PyExc_RuntimeError,
"the bucket being iterated changed size");
return -1;
}
Py_INCREF(currentbucket);
Py_DECREF(self->currentbucket);
self->currentbucket = currentbucket;
self->currentoffset = currentoffset;
self->pseudoindex = pseudoindex;
return 0;
no_match:
IndexError(i);
return -1;
}
/* Return the right kind ('k','v','i') of entry from bucket b at offset i.
* b must be activated. Returns NULL on error.
*/
static PyObject *
getBucketEntry(Bucket *b, int i, char kind)
{
PyObject *result = NULL;
assert(b);
assert(0 <= i && i < b->len);
switch (kind)
{
case 'k':
COPY_KEY_TO_OBJECT(result, b->keys[i]);
break;
case 'v':
COPY_VALUE_TO_OBJECT(result, b->values[i]);
break;
case 'i':
{
PyObject *key;
PyObject *value;;
COPY_KEY_TO_OBJECT(key, b->keys[i]);
if (!key)
break;
COPY_VALUE_TO_OBJECT(value, b->values[i]);
if (!value)
{
Py_DECREF(key);
break;
}
result = PyTuple_New(2);
if (result)
{
PyTuple_SET_ITEM(result, 0, key);
PyTuple_SET_ITEM(result, 1, value);
}
else
{
Py_DECREF(key);
Py_DECREF(value);