Skip to content

Commit 20b5dfd

Browse files
authored
Class families (#200)
* Warning for uninitialized storage * Drop free functions, add __module__ and __all__ * Fix a few more missing __module__s * Clean up __all__ * Remove .reduce and .project from cpp class * Move Axis repr to Python and add transforms * Lookup for transforms works * Using repr from Python for Histogram * Use Boost.Histogram << as repr for cpp.histogram * Helpful error when C++ code not built * Use register for Axes * Use simpler storage scheme * Remove final _to_ function * CPP histogram returns CPP axis now * Revamp decorator system, now could be useful in other packages * Adding subclassing test * Adding Storage/Transforms to the register system * Simplify: no longer require @register for direct subclasses * Unicode strings in repr on Python 2 (fix test) * Simplify use of _compute_common_index * Drop a few extra __module__ sets that were superfluous * Fix __module__ on accumulators and slicing
1 parent 9398302 commit 20b5dfd

34 files changed

+982
-551
lines changed

boost_histogram/__init__.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
from __future__ import absolute_import, division, print_function
22

3+
# Sadly, some tools (IPython) do not respect __all__
4+
# as a list of public items in a module. So we need
5+
# to delete / hide any extra items manually.
36
del absolute_import, division, print_function
47

8+
__all__ = (
9+
"Histogram",
10+
"axis",
11+
"storage",
12+
"accumulators",
13+
"algorithm",
14+
"utils",
15+
"numpy",
16+
"loc",
17+
"rebin",
18+
"sum",
19+
"underflow",
20+
"overflow",
21+
"__version__",
22+
)
23+
24+
25+
try:
26+
from . import _core
27+
except ImportError as err:
28+
err.msg += (
29+
"\nDid you forget to compile? Use CMake or Setuptools to build, see the readme"
30+
)
31+
raise err
32+
33+
534
from ._internal.hist import Histogram
6-
from . import axis, storage, accumulators, algorithm, numpy
35+
from . import axis, storage, accumulators, algorithm, utils, numpy
736
from .tag import loc, rebin, sum, underflow, overflow
37+
838
from .version import __version__
939

1040
# Workarounds for smooth transitions from 0.5 series. Will be removed after 0.6.
11-
histogram = Histogram
12-
13-
from .version import __version__
1441

1542
from .tag import project
1643

0 commit comments

Comments
 (0)