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
63823f71
Commit
63823f71
authored
Mar 21, 2020
by
Jason Madden
Committed by
GitHub
Mar 21, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #136 from zopefoundation/issue132
Fix __all__
parents
f9b05982
2908ae74
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
21 deletions
+48
-21
.gitignore
.gitignore
+1
-0
.travis.yml
.travis.yml
+8
-0
BTrees/_module_builder.py
BTrees/_module_builder.py
+8
-2
BTrees/tests/common.py
BTrees/tests/common.py
+27
-17
CHANGES.rst
CHANGES.rst
+3
-2
setup.py
setup.py
+1
-0
No files found.
.gitignore
View file @
63823f71
...
...
@@ -18,3 +18,4 @@ dist
.eggs/
.dir-locals.el
pip-wheel-metadata/
htmlcov/
.travis.yml
View file @
63823f71
...
...
@@ -17,6 +17,14 @@ python:
jobs
:
include
:
-
name
:
Documentation
python
:
3.8
install
:
-
pip install -U -e .[docs]
script
:
-
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
-
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
after_success
:
# Special Linux builds
-
name
:
"
Python:
2.7,
pure
(no
C
extensions)"
...
...
BTrees/_module_builder.py
View file @
63823f71
...
...
@@ -127,8 +127,15 @@ def populate_module(mod_globals,
from
._base
import
_fix_pickle
module_name
=
mod_globals
[
'__name__'
]
# Define the Python implementations
mod_globals
.
update
(
_create_globals
(
module_name
,
key_datatype
,
value_datatype
))
# Import the C versions, if possible. Whether or not this is possible,
# this currently makes the non-`Py' suffixed names available. This should change
# if we start defining the Python classes with their natural name, only aliased
# to the 'Py` suffix (which simplifies pickling)
import_c_extension
(
mod_globals
)
# Next, define __all__ after all the name aliasing is done.
# XXX: Maybe derive this from the values we create.
mod_all
=
(
'Bucket'
,
'Set'
,
'BTree'
,
'TreeSet'
,
...
...
@@ -143,10 +150,9 @@ def populate_module(mod_globals,
mod_globals
[
'using64bits'
]
=
key_datatype
.
using64bits
or
value_datatype
.
using64bits
import_c_extension
(
mod_globals
)
# XXX: We can probably do better than fix_pickle now;
# we can know if we're going to be renaming classes
# ahead of time.
# ahead of time.
See above.
_fix_pickle
(
mod_globals
,
module_name
)
directlyProvides
(
module
or
sys
.
modules
[
module_name
],
interface
)
...
...
BTrees/tests/common.py
View file @
63823f71
...
...
@@ -1972,17 +1972,23 @@ class ModuleTest(object):
value_type
=
None
def
_getModule
(
self
):
pass
def
testNames
(
self
):
names
=
[
'Bucket'
,
'BTree'
,
'Set'
,
'TreeSet'
]
mod
=
self
.
_getModule
()
mod_all
=
mod
.
__all__
for
name
in
names
:
klass
=
getattr
(
self
.
_getModule
()
,
name
)
self
.
assertEqual
(
klass
.
__module__
,
self
.
_getModule
()
.
__name__
)
self
.
assertIs
(
klass
,
getattr
(
self
.
_getModule
()
,
klass
=
getattr
(
mod
,
name
)
self
.
assertEqual
(
klass
.
__module__
,
mod
.
__name__
)
self
.
assertIs
(
klass
,
getattr
(
mod
,
self
.
prefix
+
name
))
self
.
assertIn
(
name
,
mod_all
)
self
.
assertIn
(
self
.
prefix
+
name
,
mod_all
)
# BBB for zope.app.security ZCML :(
pfx_iter
=
self
.
prefix
+
'TreeIterator'
klass
=
getattr
(
self
.
_getModule
()
,
pfx_iter
)
self
.
assertEqual
(
klass
.
__module__
,
self
.
_getModule
()
.
__name__
)
klass
=
getattr
(
mod
,
pfx_iter
)
self
.
assertEqual
(
klass
.
__module__
,
mod
.
__name__
)
def
testModuleProvides
(
self
):
from
zope.interface.verify
import
verifyObject
...
...
@@ -1998,25 +2004,29 @@ class ModuleTest(object):
elif
'I'
in
self
.
prefix
:
self
.
assertTrue
(
self
.
_getModule
().
family
is
BTrees
.
family32
)
def
_check_union_presence
(
self
,
datatype
,
name
):
mod
=
self
.
_getModule
()
if
datatype
.
supports_value_union
():
in_
=
self
.
assertIn
has
=
self
.
assertTrue
else
:
in_
=
self
.
assertNotIn
has
=
self
.
assertFalse
in_
(
name
,
dir
(
mod
))
has
(
hasattr
(
mod
,
name
))
in_
(
name
,
mod
.
__all__
)
# The weighted* functions require the value type to support unions.
def
test_weightedUnion_presence
(
self
):
if
self
.
value_type
.
supports_value_union
():
self
.
assertTrue
(
hasattr
(
self
.
_getModule
(),
'weightedUnion'
))
else
:
self
.
assertFalse
(
hasattr
(
self
.
_getModule
(),
'weightedUnion'
))
self
.
_check_union_presence
(
self
.
value_type
,
'weightedUnion'
)
def
test_weightedIntersection_presence
(
self
):
if
self
.
value_type
.
supports_value_union
():
self
.
assertTrue
(
hasattr
(
self
.
_getModule
(),
'weightedIntersection'
))
else
:
self
.
assertFalse
(
hasattr
(
self
.
_getModule
(),
'weightedIntersection'
))
self
.
_check_union_presence
(
self
.
value_type
,
'weightedIntersection'
)
# The multiunion function requires the key type to support unions
def
test_multiunion_presence
(
self
):
if
self
.
key_type
.
supports_value_union
():
self
.
assertTrue
(
hasattr
(
self
.
_getModule
(),
'multiunion'
))
else
:
self
.
assertFalse
(
hasattr
(
self
.
_getModule
(),
'multiunion'
))
self
.
_check_union_presence
(
self
.
key_type
,
'multiunion'
)
class
I_SetsBase
(
object
):
...
...
CHANGES.rst
View file @
63823f71
...
...
@@ -5,7 +5,9 @@
4.7.1 (unreleased)
==================
- Nothing changed yet.
- Fix the definitions of ``__all__`` in modules. In 4.7.0, they
incorrectly left out names. See `PR 132
<https://github.com/zopefoundation/BTrees/pull/132>`_.
4.7.0 (2020-03-17)
...
...
@@ -23,7 +25,6 @@
consistent between Python 2 and Python 3 and between 32-bit and
64-bit variants.
- Make the Bucket types consistent with the BTree types as updated in
versions 4.3.2: Querying for keys with default comparisons or that
are not integers no longer raises ``TypeError``.
...
...
setup.py
View file @
63823f71
...
...
@@ -223,6 +223,7 @@ setup(name='BTrees',
'docs'
:
[
'Sphinx'
,
'repoze.sphinx.autointerface'
,
'sphinx_rtd_theme'
,
],
},
test_suite
=
"BTrees.tests"
,
...
...
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