From 751506408bac8b487186796dd886db35beaa2616 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Mon, 14 Oct 2019 08:19:12 -0500 Subject: [PATCH] Put all array classes in an 'array' directory ('include', 'src', and '_numba'). (#17) --- CMakeLists.txt | 2 +- Doxyfile | 2 +- VERSION_INFO | 2 +- awkward1/_numba/__init__.py | 6 +-- awkward1/_numba/array/__init__.py | 1 + awkward1/_numba/{ => array}/listarray.py | 14 ++--- .../_numba/{ => array}/listoffsetarray.py | 18 +++---- awkward1/_numba/{ => array}/numpyarray.py | 2 +- awkward1/_numba/util.py | 4 +- awkward1/signatures/Content_8cpp.xml | 4 +- awkward1/signatures/ListArray_8cpp.xml | 26 +++++----- awkward1/signatures/ListOffsetArray_8cpp.xml | 42 +++++++-------- awkward1/signatures/NumpyArray_8cpp.xml | 18 +++---- awkward1/signatures/getitem_8cpp.xml | 52 +++++++++---------- include/awkward/{ => array}/ListArray.h | 0 include/awkward/{ => array}/ListOffsetArray.h | 0 include/awkward/{ => array}/NumpyArray.h | 0 include/awkward/{ => array}/RawArray.h | 0 src/libawkward/Content.cpp | 2 +- src/libawkward/{ => array}/ListArray.cpp | 4 +- .../{ => array}/ListOffsetArray.cpp | 4 +- src/libawkward/{ => array}/NumpyArray.cpp | 2 +- src/pyawkward.cpp | 6 +-- ...test_PR016_finish_getitem_for_rawarray.cpp | 6 +-- 24 files changed, 109 insertions(+), 108 deletions(-) create mode 100644 awkward1/_numba/array/__init__.py rename awkward1/_numba/{ => array}/listarray.py (97%) rename awkward1/_numba/{ => array}/listoffsetarray.py (97%) rename awkward1/_numba/{ => array}/numpyarray.py (99%) rename include/awkward/{ => array}/ListArray.h (100%) rename include/awkward/{ => array}/ListOffsetArray.h (100%) rename include/awkward/{ => array}/NumpyArray.h (100%) rename include/awkward/{ => array}/RawArray.h (100%) rename src/libawkward/{ => array}/ListArray.cpp (99%) rename src/libawkward/{ => array}/ListOffsetArray.cpp (99%) rename src/libawkward/{ => array}/NumpyArray.cpp (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b1d712606..8dfafc9b4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ add_definitions(-DVERSION_INFO="${VERSION_INFO}") set(CMAKE_MACOSX_RPATH 1) file(GLOB CPU_KERNEL_SOURCES "src/cpu-kernels/*.cpp") -file(GLOB LIBAWKWARD_SOURCES "src/libawkward/*.cpp") +file(GLOB LIBAWKWARD_SOURCES "src/libawkward/*.cpp" "src/libawkward/array/*.cpp") include_directories(include) add_subdirectory(pybind11) diff --git a/Doxyfile b/Doxyfile index 5452423570..f93ef45aa0 100644 --- a/Doxyfile +++ b/Doxyfile @@ -829,7 +829,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src/cpu-kernels src/libawkward +INPUT = src/cpu-kernels src/libawkward src/libawkward/array # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/VERSION_INFO b/VERSION_INFO index 7ac4e5e38f..71d6a66eda 100644 --- a/VERSION_INFO +++ b/VERSION_INFO @@ -1 +1 @@ -0.1.13 +0.1.14 diff --git a/awkward1/_numba/__init__.py b/awkward1/_numba/__init__.py index dae1713042..ab50f5cb90 100644 --- a/awkward1/_numba/__init__.py +++ b/awkward1/_numba/__init__.py @@ -11,6 +11,6 @@ import awkward1._numba.identity import awkward1._numba.content import awkward1._numba.iterator - import awkward1._numba.numpyarray - import awkward1._numba.listarray - import awkward1._numba.listoffsetarray + import awkward1._numba.array.numpyarray + import awkward1._numba.array.listarray + import awkward1._numba.array.listoffsetarray diff --git a/awkward1/_numba/array/__init__.py b/awkward1/_numba/array/__init__.py new file mode 100644 index 0000000000..76ca65bb4e --- /dev/null +++ b/awkward1/_numba/array/__init__.py @@ -0,0 +1 @@ +# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE diff --git a/awkward1/_numba/listarray.py b/awkward1/_numba/array/listarray.py similarity index 97% rename from awkward1/_numba/listarray.py rename to awkward1/_numba/array/listarray.py index 37ae7b81fa..2056d47b61 100644 --- a/awkward1/_numba/listarray.py +++ b/awkward1/_numba/array/listarray.py @@ -8,7 +8,7 @@ import numba.typing.ctypes_utils import awkward1.layout -from .._numba import cpu, util, content +from ..._numba import cpu, util, content @numba.extending.typeof_impl.register(awkward1.layout.ListArray32) @numba.extending.typeof_impl.register(awkward1.layout.ListArray64) @@ -47,7 +47,7 @@ def getitem_tuple(self, wheretpe): return outtpe.getitem_int() def getitem_next(self, wheretpe, isadvanced): - import awkward1._numba.listoffsetarray + import awkward1._numba.array.listoffsetarray if len(wheretpe.types) == 0: return self headtpe = wheretpe.types[0] @@ -58,7 +58,7 @@ def getitem_next(self, wheretpe, isadvanced): elif isinstance(headtpe, numba.types.SliceType): contenttpe = self.contenttpe.carry().getitem_next(tailtpe, isadvanced) - return awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe) + return awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe) elif isinstance(headtpe, numba.types.EllipsisType): raise NotImplementedError("ellipsis") @@ -71,7 +71,7 @@ def getitem_next(self, wheretpe, isadvanced): raise NotImplementedError("array.ndim != 1") contenttpe = self.contenttpe.carry().getitem_next(tailtpe, True) if not isadvanced: - return awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe) + return awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe) else: return contenttpe @@ -238,7 +238,7 @@ def lower_getitem_other(context, builder, sig, args): return lower_getitem_tuple(context, builder, rettpe(arraytpe, wrappedtpe), (arrayval, wrappedval)) def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, advanced): - import awkward1._numba.listoffsetarray + import awkward1._numba.array.listoffsetarray if len(wheretpe.types) == 0: return arrayval @@ -349,7 +349,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, outcontenttpe = nextcontenttpe.getitem_next(tailtpe, True) outcontentval = nextcontenttpe.lower_getitem_next(context, builder, nextcontenttpe, tailtpe, nextcontentval, tailval, nextadvanced) - outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe) + outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe) proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder) proxyout.offsets = nextoffsets proxyout.content = outcontentval @@ -404,7 +404,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, contenttpe = nexttpe.getitem_next(tailtpe, True) contentval = nexttpe.lower_getitem_next(context, builder, nexttpe, tailtpe, nextval, tailval, nextadvanced) - outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), contenttpe, arraytpe.idtpe) + outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), contenttpe, arraytpe.idtpe) proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder) proxyout.offsets = nextoffsets proxyout.content = contentval diff --git a/awkward1/_numba/listoffsetarray.py b/awkward1/_numba/array/listoffsetarray.py similarity index 97% rename from awkward1/_numba/listoffsetarray.py rename to awkward1/_numba/array/listoffsetarray.py index e6a1e21cd5..e6c3098f94 100644 --- a/awkward1/_numba/listoffsetarray.py +++ b/awkward1/_numba/array/listoffsetarray.py @@ -7,7 +7,7 @@ import numba.typing.arraydecl import awkward1.layout -from .._numba import cpu, util, content +from ..._numba import cpu, util, content @numba.extending.typeof_impl.register(awkward1.layout.ListOffsetArray32) @numba.extending.typeof_impl.register(awkward1.layout.ListOffsetArray64) @@ -36,8 +36,8 @@ def getitem_range(self): return self def getitem_tuple(self, wheretpe): - import awkward1._numba.listarray - nexttpe = awkward1._numba.listarray.ListArrayType(util.index64tpe, util.index64tpe, self, numba.none) + import awkward1._numba.array.listarray + nexttpe = awkward1._numba.array.listarray.ListArrayType(util.index64tpe, util.index64tpe, self, numba.none) out = nexttpe.getitem_next(wheretpe, False) return out.getitem_int() @@ -73,8 +73,8 @@ def getitem_next(self, wheretpe, isadvanced): raise AssertionError(headtpe) def carry(self): - import awkward1._numba.listarray - return awkward1._numba.listarray.ListArrayType(self.offsetstpe, self.offsetstpe, self.contenttpe, self.idtpe) + import awkward1._numba.array.listarray + return awkward1._numba.array.listarray.ListArrayType(self.offsetstpe, self.offsetstpe, self.contenttpe, self.idtpe) @property def lower_len(self): @@ -251,7 +251,7 @@ def starts_stops(context, builder, offsetstpe, offsetsval, lenstarts, lenoffsets return starts, stops def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, advanced): - import awkward1._numba.listarray + import awkward1._numba.array.listarray if len(wheretpe.types) == 0: return arrayval @@ -361,7 +361,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, outcontenttpe = nextcontenttpe.getitem_next(tailtpe, True) outcontentval = nextcontenttpe.lower_getitem_next(context, builder, nextcontenttpe, tailtpe, nextcontentval, tailval, nextadvanced) - outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe) + outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe) proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder) proxyout.offsets = nextoffsets proxyout.content = outcontentval @@ -457,7 +457,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, raise AssertionError(headtpe) def lower_carry(context, builder, arraytpe, carrytpe, arrayval, carryval): - import awkward1._numba.listarray + import awkward1._numba.array.listarray proxyin = numba.cgutils.create_struct_proxy(arraytpe)(context, builder, value=arrayval) lenoffsets = util.arraylen(context, builder, arraytpe.offsetstpe, proxyin.offsets, totpe=numba.int64) @@ -465,7 +465,7 @@ def lower_carry(context, builder, arraytpe, carrytpe, arrayval, carryval): starts, stops = starts_stops(context, builder, arraytpe.offsetstpe, proxyin.offsets, lenstarts, lenoffsets) - proxyout = numba.cgutils.create_struct_proxy(awkward1._numba.listarray.ListArrayType(arraytpe.offsetstpe, arraytpe.offsetstpe, arraytpe.contenttpe, arraytpe.idtpe))(context, builder) + proxyout = numba.cgutils.create_struct_proxy(awkward1._numba.array.listarray.ListArrayType(arraytpe.offsetstpe, arraytpe.offsetstpe, arraytpe.contenttpe, arraytpe.idtpe))(context, builder) proxyout.starts = numba.targets.arrayobj.fancy_getitem_array(context, builder, arraytpe.offsetstpe(arraytpe.offsetstpe, carrytpe), (starts, carryval)) proxyout.stops = numba.targets.arrayobj.fancy_getitem_array(context, builder, arraytpe.offsetstpe(arraytpe.offsetstpe, carrytpe), (stops, carryval)) diff --git a/awkward1/_numba/numpyarray.py b/awkward1/_numba/array/numpyarray.py similarity index 99% rename from awkward1/_numba/numpyarray.py rename to awkward1/_numba/array/numpyarray.py index 6aeebf6800..5e2776ae8e 100644 --- a/awkward1/_numba/numpyarray.py +++ b/awkward1/_numba/array/numpyarray.py @@ -8,7 +8,7 @@ import numba.typing.ctypes_utils import awkward1.layout -from .._numba import cpu, util, identity, content +from ..._numba import cpu, util, identity, content @numba.extending.typeof_impl.register(awkward1.layout.NumpyArray) def typeof(val, c): diff --git a/awkward1/_numba/util.py b/awkward1/_numba/util.py index da9a854e31..c11852b1cc 100644 --- a/awkward1/_numba/util.py +++ b/awkward1/_numba/util.py @@ -222,10 +222,10 @@ def preprocess_slicetuple(context, builder, wheretpe, whereval): return wheretpe3, whereval3 def wrap_for_slicetuple(context, builder, arraytpe, arrayval): - import awkward1._numba.listarray + import awkward1._numba.array.listarray length = arraylen(context, builder, arraytpe, arrayval, totpe=numba.int64) - nexttpe = awkward1._numba.listarray.ListArrayType(index64tpe, index64tpe, arraytpe, numba.types.none) + nexttpe = awkward1._numba.array.listarray.ListArrayType(index64tpe, index64tpe, arraytpe, numba.types.none) proxynext = numba.cgutils.create_struct_proxy(nexttpe)(context, builder) proxynext.starts = newindex64(context, builder, numba.int64, context.get_constant(numba.int64, 1)) proxynext.stops = newindex64(context, builder, numba.int64, context.get_constant(numba.int64, 1)) diff --git a/awkward1/signatures/Content_8cpp.xml b/awkward1/signatures/Content_8cpp.xml index 6d83197627..6df78d0b02 100644 --- a/awkward1/signatures/Content_8cpp.xml +++ b/awkward1/signatures/Content_8cpp.xml @@ -2,7 +2,7 @@ Content.cpp - awkward/ListArray.h + awkward/array/ListArray.h awkward/Content.h @@ -17,7 +17,7 @@ - + awkward diff --git a/awkward1/signatures/ListArray_8cpp.xml b/awkward1/signatures/ListArray_8cpp.xml index a3f0c35f85..de9e0bec3e 100644 --- a/awkward1/signatures/ListArray_8cpp.xml +++ b/awkward1/signatures/ListArray_8cpp.xml @@ -7,17 +7,14 @@ awkward/cpu-kernels/identity.h awkward/cpu-kernels/getitem.h awkward/Slice.h - awkward/ListOffsetArray.h - awkward/ListArray.h + awkward/array/ListOffsetArray.h + awkward/array/ListArray.h - - - - + @@ -34,27 +31,30 @@ + + + + + + + + + - - - - - - awkward - + diff --git a/awkward1/signatures/ListOffsetArray_8cpp.xml b/awkward1/signatures/ListOffsetArray_8cpp.xml index b364c480ee..865e812ee9 100644 --- a/awkward1/signatures/ListOffsetArray_8cpp.xml +++ b/awkward1/signatures/ListOffsetArray_8cpp.xml @@ -7,8 +7,8 @@ awkward/cpu-kernels/identity.h awkward/cpu-kernels/getitem.h awkward/Slice.h - awkward/ListArray.h - awkward/ListOffsetArray.h + awkward/array/ListArray.h + awkward/array/ListOffsetArray.h @@ -16,23 +16,8 @@ - - - - - - - - - - - - - - - - + @@ -49,6 +34,21 @@ + + + + + + + + + + + + + + + awkward @@ -72,7 +72,7 @@ - + @@ -94,13 +94,13 @@ - + - + diff --git a/awkward1/signatures/NumpyArray_8cpp.xml b/awkward1/signatures/NumpyArray_8cpp.xml index 91c7816f51..b291b6cf56 100644 --- a/awkward1/signatures/NumpyArray_8cpp.xml +++ b/awkward1/signatures/NumpyArray_8cpp.xml @@ -7,13 +7,13 @@ stdexcept awkward/cpu-kernels/identity.h awkward/cpu-kernels/getitem.h - awkward/NumpyArray.h + awkward/array/NumpyArray.h - + @@ -37,12 +37,12 @@ + + + - - - awkward @@ -74,7 +74,7 @@ - + const std::vector< ssize_t > @@ -91,7 +91,7 @@ - + const std::vector< ssize_t > @@ -108,13 +108,13 @@ - + - + diff --git a/awkward1/signatures/getitem_8cpp.xml b/awkward1/signatures/getitem_8cpp.xml index 4a89a4d236..34ea78f08e 100644 --- a/awkward1/signatures/getitem_8cpp.xml +++ b/awkward1/signatures/getitem_8cpp.xml @@ -1034,7 +1034,7 @@ - + Error @@ -1071,7 +1071,7 @@ - + @@ -1120,7 +1120,7 @@ - + Error @@ -1161,7 +1161,7 @@ - + Error @@ -1202,7 +1202,7 @@ - + @@ -1256,7 +1256,7 @@ - + Error @@ -1305,7 +1305,7 @@ - + Error @@ -1354,7 +1354,7 @@ - + @@ -1415,7 +1415,7 @@ - + Error @@ -1468,7 +1468,7 @@ - + Error @@ -1521,7 +1521,7 @@ - + @@ -1554,7 +1554,7 @@ - + Error @@ -1579,7 +1579,7 @@ - + Error @@ -1604,7 +1604,7 @@ - + @@ -1641,7 +1641,7 @@ - + Error @@ -1670,7 +1670,7 @@ - + Error @@ -1699,7 +1699,7 @@ - + @@ -1764,7 +1764,7 @@ - + Error @@ -1821,7 +1821,7 @@ - + Error @@ -1878,7 +1878,7 @@ - + @@ -1943,7 +1943,7 @@ - + Error @@ -2000,7 +2000,7 @@ - + Error @@ -2057,7 +2057,7 @@ - + @@ -2114,7 +2114,7 @@ - + Error @@ -2163,7 +2163,7 @@ - + Error @@ -2212,7 +2212,7 @@ - + diff --git a/include/awkward/ListArray.h b/include/awkward/array/ListArray.h similarity index 100% rename from include/awkward/ListArray.h rename to include/awkward/array/ListArray.h diff --git a/include/awkward/ListOffsetArray.h b/include/awkward/array/ListOffsetArray.h similarity index 100% rename from include/awkward/ListOffsetArray.h rename to include/awkward/array/ListOffsetArray.h diff --git a/include/awkward/NumpyArray.h b/include/awkward/array/NumpyArray.h similarity index 100% rename from include/awkward/NumpyArray.h rename to include/awkward/array/NumpyArray.h diff --git a/include/awkward/RawArray.h b/include/awkward/array/RawArray.h similarity index 100% rename from include/awkward/RawArray.h rename to include/awkward/array/RawArray.h diff --git a/src/libawkward/Content.cpp b/src/libawkward/Content.cpp index aa92c48a12..f3d5640366 100644 --- a/src/libawkward/Content.cpp +++ b/src/libawkward/Content.cpp @@ -1,6 +1,6 @@ // BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE -#include "awkward/ListArray.h" +#include "awkward/array/ListArray.h" #include "awkward/Content.h" diff --git a/src/libawkward/ListArray.cpp b/src/libawkward/array/ListArray.cpp similarity index 99% rename from src/libawkward/ListArray.cpp rename to src/libawkward/array/ListArray.cpp index 70ca3593da..95530882da 100644 --- a/src/libawkward/ListArray.cpp +++ b/src/libawkward/array/ListArray.cpp @@ -6,9 +6,9 @@ #include "awkward/cpu-kernels/identity.h" #include "awkward/cpu-kernels/getitem.h" #include "awkward/Slice.h" -#include "awkward/ListOffsetArray.h" +#include "awkward/array/ListOffsetArray.h" -#include "awkward/ListArray.h" +#include "awkward/array/ListArray.h" namespace awkward { template diff --git a/src/libawkward/ListOffsetArray.cpp b/src/libawkward/array/ListOffsetArray.cpp similarity index 99% rename from src/libawkward/ListOffsetArray.cpp rename to src/libawkward/array/ListOffsetArray.cpp index 11fb91e925..a2697fe199 100644 --- a/src/libawkward/ListOffsetArray.cpp +++ b/src/libawkward/array/ListOffsetArray.cpp @@ -6,9 +6,9 @@ #include "awkward/cpu-kernels/identity.h" #include "awkward/cpu-kernels/getitem.h" #include "awkward/Slice.h" -#include "awkward/ListArray.h" +#include "awkward/array/ListArray.h" -#include "awkward/ListOffsetArray.h" +#include "awkward/array/ListOffsetArray.h" namespace awkward { template diff --git a/src/libawkward/NumpyArray.cpp b/src/libawkward/array/NumpyArray.cpp similarity index 99% rename from src/libawkward/NumpyArray.cpp rename to src/libawkward/array/NumpyArray.cpp index fa3ca8e679..b3402ac8c6 100644 --- a/src/libawkward/NumpyArray.cpp +++ b/src/libawkward/array/NumpyArray.cpp @@ -7,7 +7,7 @@ #include "awkward/cpu-kernels/identity.h" #include "awkward/cpu-kernels/getitem.h" -#include "awkward/NumpyArray.h" +#include "awkward/array/NumpyArray.h" namespace awkward { ssize_t NumpyArray::ndim() const { diff --git a/src/pyawkward.cpp b/src/pyawkward.cpp index 9678477688..4b7c78b7dd 100644 --- a/src/pyawkward.cpp +++ b/src/pyawkward.cpp @@ -11,9 +11,9 @@ #include "awkward/Identity.h" #include "awkward/Content.h" #include "awkward/Iterator.h" -#include "awkward/NumpyArray.h" -#include "awkward/ListArray.h" -#include "awkward/ListOffsetArray.h" +#include "awkward/array/NumpyArray.h" +#include "awkward/array/ListArray.h" +#include "awkward/array/ListOffsetArray.h" namespace py = pybind11; namespace ak = awkward; diff --git a/tests/test_PR016_finish_getitem_for_rawarray.cpp b/tests/test_PR016_finish_getitem_for_rawarray.cpp index ab262d6939..d572bd0767 100644 --- a/tests/test_PR016_finish_getitem_for_rawarray.cpp +++ b/tests/test_PR016_finish_getitem_for_rawarray.cpp @@ -3,9 +3,9 @@ #include #include "awkward/Identity.h" -#include "awkward/RawArray.h" -#include "awkward/ListArray.h" -#include "awkward/ListOffsetArray.h" +#include "awkward/array/RawArray.h" +#include "awkward/array/ListArray.h" +#include "awkward/array/ListOffsetArray.h" #include "awkward/Slice.h" using namespace awkward;