Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
BTrees
Commits
3f3736b9
Commit
3f3736b9
authored
Mar 18, 2020
by
Éloi Rivard
Committed by
GitHub
Mar 18, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #130 from azmeuk/doclinks
Added internal documentation links
parents
ce69faf6
9141a4df
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
37 deletions
+40
-37
BTrees/Interfaces.py
BTrees/Interfaces.py
+30
-27
BTrees/check.py
BTrees/check.py
+5
-5
docs/conf.py
docs/conf.py
+1
-1
docs/overview.rst
docs/overview.rst
+4
-4
No files found.
BTrees/Interfaces.py
View file @
3f3736b9
...
@@ -33,7 +33,7 @@ class IReadSequence(Interface):
...
@@ -33,7 +33,7 @@ class IReadSequence(Interface):
def
__getitem__
(
index
):
def
__getitem__
(
index
):
"""Return the value at the given index.
"""Return the value at the given index.
An
IndexError
is raised if the index cannot be found.
An
:class:`IndexError`
is raised if the index cannot be found.
"""
"""
def
__getslice__
(
index1
,
index2
):
def
__getslice__
(
index1
,
index2
):
...
@@ -52,9 +52,9 @@ class IKeyed(ICollection):
...
@@ -52,9 +52,9 @@ class IKeyed(ICollection):
"""
"""
def
keys
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
def
keys
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
"""Return an
IReadSequence
containing the keys in the collection.
"""Return an
:class:`~BTrees.Interfaces.IReadSequence`
containing the keys in the collection.
The type of the
IReadSequence
is not specified. It could be a list
The type of the
:class:`~BTrees.Interfaces.IReadSequence`
is not specified. It could be a list
or a tuple or some other type.
or a tuple or some other type.
All arguments are optional, and may be specified as keyword
All arguments are optional, and may be specified as keyword
...
@@ -101,7 +101,7 @@ class ISetMutable(IKeyed):
...
@@ -101,7 +101,7 @@ class ISetMutable(IKeyed):
def
remove
(
key
):
def
remove
(
key
):
"""Remove the key from the set.
"""Remove the key from the set.
Raises
KeyError
if key is not in the set.
Raises
:class:`KeyError`
if key is not in the set.
"""
"""
def
update
(
seq
):
def
update
(
seq
):
...
@@ -137,13 +137,15 @@ class IMinimalDictionary(ISized, IKeyed):
...
@@ -137,13 +137,15 @@ class IMinimalDictionary(ISized, IKeyed):
def
get
(
key
,
default
):
def
get
(
key
,
default
):
"""Get the value associated with the given key.
"""Get the value associated with the given key.
Return the default if has_key(key) is false.
Return the default if :meth:`~BTrees.Interfaces.IKeyed.has_key` is false
with the given key.
"""
"""
def
__getitem__
(
key
):
def
__getitem__
(
key
):
"""Get the value associated with the given key.
"""Get the value associated with the given key.
Raise KeyError if has_key(key) is false.
Raise :class:`KeyError` if :meth:`~BTrees.Interfaces.IKeyed.has_key` is false
with the given key.
"""
"""
def
__setitem__
(
key
,
value
):
def
__setitem__
(
key
,
value
):
...
@@ -152,13 +154,14 @@ class IMinimalDictionary(ISized, IKeyed):
...
@@ -152,13 +154,14 @@ class IMinimalDictionary(ISized, IKeyed):
def
__delitem__
(
key
):
def
__delitem__
(
key
):
"""Delete the value associated with the given key.
"""Delete the value associated with the given key.
Raise KeyError if has_key(key) is false.
Raise class:`KeyError` if :meth:`~BTrees.Interfaces.IKeyed.has_key` is false
with the given key.
"""
"""
def
values
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
def
values
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
"""Return an
IReadSequence
containing the values in the collection.
"""Return an
:class:`BTrees.Interfaces.IReadSequence`
containing the values in the collection.
The type of the
IReadSequence is not specified.
It could be a list
The type of the
:class:`~BTrees.Interfaces.IReadSequence` is not specified.
It could be a list
or a tuple or some other type.
or a tuple or some other type.
All arguments are optional, and may be specified as keyword
All arguments are optional, and may be specified as keyword
...
@@ -180,11 +183,11 @@ class IMinimalDictionary(ISized, IKeyed):
...
@@ -180,11 +183,11 @@ class IMinimalDictionary(ISized, IKeyed):
"""
"""
def
items
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
def
items
(
min
=
None
,
max
=
None
,
excludemin
=
False
,
excludemax
=
False
):
"""Return an
IReadSequence
containing the items in the collection.
"""Return an
:class:`BTrees.Interfaces.IReadSequence`
containing the items in the collection.
An item is a 2-tuple, a (key, value) pair.
An item is a 2-tuple, a (key, value) pair.
The type of the
IReadSequence
is not specified. It could be a list
The type of the
:class:`BTrees.Interfaces.IReadSequence`
is not specified. It could be a list
or a tuple or some other type.
or a tuple or some other type.
All arguments are optional, and may be specified as keyword
All arguments are optional, and may be specified as keyword
...
@@ -226,19 +229,19 @@ class IDictionaryIsh(IMinimalDictionary):
...
@@ -226,19 +229,19 @@ class IDictionaryIsh(IMinimalDictionary):
def
setdefault
(
key
,
d
):
def
setdefault
(
key
,
d
):
"""D.setdefault(k, d) -> D.get(k, d), also set D[k]=d if k not in D.
"""D.setdefault(k, d) -> D.get(k, d), also set D[k]=d if k not in D.
Return the value like
get()
except that if key is missing, d is both
Return the value like
:meth:`~BTrees.Interfaces.IMinimalDictionary.get`
except that if key is missing, d is both
returned and inserted into the dictionary as the value of k.
returned and inserted into the dictionary as the value of k.
Note that, unlike as for Python's
dict.setdefault()
, d is not
Note that, unlike as for Python's
:meth:`dict.setdefault`
, d is not
optional. Python defaults d to None, but that doesn't make sense
optional. Python defaults d to None, but that doesn't make sense
for mappings that can't have None as a value (for example, an
for mappings that can't have None as a value (for example, an
IIBTree
can have only integers as values).
:class:`~BTrees.IIBTree.IIBTree`
can have only integers as values).
"""
"""
def
pop
(
key
,
d
):
def
pop
(
key
,
d
):
"""D.pop(k[, d]) -> v, remove key and return the corresponding value.
"""D.pop(k[, d]) -> v, remove key and return the corresponding value.
If key is not found, d is returned if given, otherwise
KeyError
is
If key is not found, d is returned if given, otherwise
:class:`KeyError`
is
raised.
raised.
"""
"""
...
@@ -271,11 +274,11 @@ class IMerge(Interface):
...
@@ -271,11 +274,11 @@ class IMerge(Interface):
These methods are supplied in modules that define collection
These methods are supplied in modules that define collection
classes with particular key and value types. The operations apply
classes with particular key and value types. The operations apply
only to collections from the same module. For example, the
only to collections from the same module. For example, the
IIBTree.union can only be used with IIBTree.IIBTree
,
:meth:`BTrees.IIBTree.IIBTree.union` can only be used with :class:`~BTrees.IIBTree.IIBTree`
,
IIBTree.IIBucket, IIBTree.IISet, and IIBTree.IITreeSet
.
:class:`~BTrees.IIBTree.IIBucket`, :class:`~BTrees.IIBTree.IISet`, and :class:`~BTrees.IIBTree.IITreeSet`
.
The implementing module has a value type. The
IOBTree and OOBTree
The implementing module has a value type. The
:class:`~BTrees.IOBTree.IOBTree` and :class:`~BTrees.OOBTree.OOBTree`
modules have object value type. The
IIBTree and OIBTree
modules
modules have object value type. The
:class:`~BTrees.IIBTree.IIBTree` and :class:`~BTrees.OIBTree.OIBTree`
modules
have integer value types. Other modules may be defined in the
have integer value types. Other modules may be defined in the
future that have other value types.
future that have other value types.
...
@@ -418,9 +421,9 @@ class IIMerge(IMerge):
...
@@ -418,9 +421,9 @@ class IIMerge(IMerge):
class
IMergeIntegerKey
(
IMerge
):
class
IMergeIntegerKey
(
IMerge
):
"""
IMerge
-able objects with integer keys.
"""
:class:`~BTrees.Interfaces.IMerge`
-able objects with integer keys.
Concretely, this means the types in
IOBTree and IIBTree
.
Concretely, this means the types in
:class:`~BTree.IOBTree.IOBTree` and :class:`~BTrees.IIBTree.IIBTree`
.
"""
"""
def
multiunion
(
seq
):
def
multiunion
(
seq
):
...
@@ -432,18 +435,18 @@ class IMergeIntegerKey(IMerge):
...
@@ -432,18 +435,18 @@ class IMergeIntegerKey(IMerge):
+ An integer, which is added to the union.
+ An integer, which is added to the union.
+ A Set or TreeSet from the same module (for example, an
+ A Set or TreeSet from the same module (for example, an
IIBTree.TreeSet for IIBTree.multiunion()
). The elements of the
:class:`BTrees.IIBTree.TreeSet` for :meth:`BTrees.IIBTree.multiunion`
). The elements of the
set are added to the union.
set are added to the union.
+ A Bucket or BTree from the same module (for example, an
+ A Bucket or BTree from the same module (for example, an
IOBTree.IOBTree for IOBTree.multiunion()
). The keys of the
:class:`BTrees.IOBTree.IOBTree` for :meth:`BTrees.IOBTree.multiunion`
). The keys of the
mapping are added to the union.
mapping are added to the union.
The union is returned as a Set from the same module (for example,
The union is returned as a Set from the same module (for example,
IIBTree.multiunion() returns an IIBTree.IISet
).
:meth:`BTrees.IIBTree.multiunion` returns an :class:`BTrees.IIBTree.IISet`
).
The point to this method is that it can run much faster than
The point to this method is that it can run much faster than
doing a sequence of two-input
union()
calls. Under the covers,
doing a sequence of two-input
:meth:`~BTrees.Interfaces.IMerge.union`
calls. Under the covers,
all the integers in all the inputs are sorted via a single
all the integers in all the inputs are sorted via a single
linear-time radix sort, then duplicates are removed in a second
linear-time radix sort, then duplicates are removed in a second
linear-time pass.
linear-time pass.
...
@@ -482,7 +485,7 @@ class IIntegerObjectBTreeModule(_IMergeBTreeModule):
...
@@ -482,7 +485,7 @@ class IIntegerObjectBTreeModule(_IMergeBTreeModule):
class
IUnsignedObjectBTreeModule
(
_IMergeBTreeModule
):
class
IUnsignedObjectBTreeModule
(
_IMergeBTreeModule
):
"""
"""
As for
`
IIntegerObjectBTreeModule` with unsigned integers.
As for
:class:`~BTrees.Interfaces.
IIntegerObjectBTreeModule` with unsigned integers.
"""
"""
...
...
BTrees/check.py
View file @
3f3736b9
...
@@ -16,7 +16,7 @@ Utilities for working with BTrees (TreeSets, Buckets, and Sets) at a low
...
@@ -16,7 +16,7 @@ Utilities for working with BTrees (TreeSets, Buckets, and Sets) at a low
level.
level.
The primary function is check(btree), which performs value-based consistency
The primary function is check(btree), which performs value-based consistency
checks of a kind
btree._check()
does not perform. See the function docstring
checks of a kind
``BTree._Tree._check()``
does not perform. See the function docstring
for details.
for details.
display(btree) displays the internal structure of a BTree (TreeSet, etc) to
display(btree) displays the internal structure of a BTree (TreeSet, etc) to
...
@@ -442,17 +442,17 @@ class Printer(Walker): #pragma NO COVER
...
@@ -442,17 +442,17 @@ class Printer(Walker): #pragma NO COVER
def
check
(
btree
):
def
check
(
btree
):
"""Check internal value-based invariants in a BTree or TreeSet.
"""Check internal value-based invariants in a BTree or TreeSet.
The
btree._check()
method checks internal C-level pointer consistency.
The
``BTrees._base._Tree._check``
method checks internal C-level pointer consistency.
The
check()
function here checks value-based invariants: whether the
The
:func:`~BTrees.check.check`
function here checks value-based invariants: whether the
keys in leaf bucket and internal nodes are in strictly increasing order,
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
and whether they all lie in their expected range. The latter is a subtle
invariant that can't be checked locally -- it requires propagating
invariant that can't be checked locally -- it requires propagating
range info down from the root of the tree, and modifying it at each
range info down from the root of the tree, and modifying it at each
level for each child.
level for each child.
Raises
AssertionError
if anything is wrong, with a string detail
Raises
:class:`AssertionError`
if anything is wrong, with a string detail
explaining the problems. The entire tree is checked before
explaining the problems. The entire tree is checked before
AssertionError
is raised, and the string detail may be large (depending
:class:`AssertionError`
is raised, and the string detail may be large (depending
on how much went wrong).
on how much went wrong).
"""
"""
...
...
docs/conf.py
View file @
3f3736b9
...
@@ -276,5 +276,5 @@ texinfo_documents = [
...
@@ -276,5 +276,5 @@ texinfo_documents = [
intersphinx_mapping
=
{
intersphinx_mapping
=
{
"python"
:
(
'https://docs.python.org/3/'
,
None
),
"python"
:
(
'https://docs.python.org/3/'
,
None
),
"persistent"
:
(
'https://persistent.readthedocs.io/en/latest/'
,
None
),
"persistent"
:
(
'https://persistent.readthedocs.io/en/latest/'
,
None
),
"ZODB"
:
(
"http
://www.zodb.org
/en/latest/"
,
None
),
"ZODB"
:
(
"http
s://zodb-docs.readthedocs.io
/en/latest/"
,
None
),
}
}
docs/overview.rst
View file @
3f3736b9
...
@@ -180,11 +180,11 @@ exclusive of the range's endpoints.
...
@@ -180,11 +180,11 @@ exclusive of the range's endpoints.
Each of the modules also defines some functions that operate on BTrees --
Each of the modules also defines some functions that operate on BTrees --
:func:`~BTrees.
_base.difference`, :func:`~BTrees._base.union`, and :func:`~BTrees._bas
e.intersection`. The
:func:`~BTrees.
Interfaces.IMerge.difference`, :func:`~BTrees.Interfaces.IMerge.union`, and :func:`~BTrees.Interfaces.IMerg
e.intersection`. The
:func:`~BTrees.
_bas
e.difference` function returns a Bucket, while the other two methods return
:func:`~BTrees.
Interfaces.IMerg
e.difference` function returns a Bucket, while the other two methods return
a Set. If the keys are integers, then the module also defines
a Set. If the keys are integers, then the module also defines
:func:`~BTrees.
_base
.multiunion`. If the values are integers or floats, then the module also
:func:`~BTrees.
Interfaces.IMergeIntegerKey
.multiunion`. If the values are integers or floats, then the module also
defines :func:`~BTrees.
_base.weightedIntersection` and :func:`~BTrees._bas
e.weightedUnion`. The function
defines :func:`~BTrees.
Interfaces.IIMerge.weightedIntersection` and :func:`~BTrees.Interfaces.IIMerg
e.weightedUnion`. The function
doc strings describe each function briefly.
doc strings describe each function briefly.
.. % XXX I'm not sure all of the following is actually correct. The
.. % XXX I'm not sure all of the following is actually correct. The
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment