Skip to content

Commit

Permalink
Replace DressedType with parameters on all the Types. (#32)
Browse files Browse the repository at this point in the history
* duplicate test_PR019 to create pull request in github

* correct PR number, update test a bit

* oops, forgot the files

* [WIP] Replace DressedType with parameters on all the Types.

* unhappy with booleans

* Attach Parameters to all Types.

* Added parameters to all Type constructors except UnionType and RecordType: need to change their signatures to accomodate.

* All Type constructors can accept 'parameters'.

* Updated Pickle getstate/setstate to pass on 'parameters'.

* Parameters are persistent properties of all non-dressed types.

* Type::equal can check parameters as part of equality, but Content::accepts still works.

* Remove Type::shallow_equal, which was only ever used in Content::accepts.

* Type parameters pass through Numba.

* Switched RecordType field name quoting to double quotes.

* Dress types using a user-controllable namespace, without DressedType.

* Implemented the '__class__' and '__str__' parameters.

* Replace all raw pointers 'Fillable*' with smart 'std::shared_ptr<Fillable>'.

* Removed the old DressedType completely (commented out).

* Removed the old DressedType completely (deleted).

* [skip ci] Fillable::beginrecord with name; Numba doesn't work yet.

* [skip ci] FillableArray.beginrecord works in Numba.

* Record names declared in FillableArray are now attached as a Type parameter.

* Various clean-ups: parameters_FIXME and Fillable Type::none() FIXMEs.

* [skip ci] FillableArray::type doesn't require a snapshot, but baretype does. (Get rid of FillableArray::type? It's redundant because you can always take a snapshot.)

* [skip ci] Working on adding Fillable*::string, but it doesn't compile yet.

* Fillable*::string compiles and works in Python.

* Fix Python-side bugs.

* Strings can be written out with 'tojson'.

* Fix Python 2.7.

* Fix Python 2.7 some more.

* Tested fromiter and fromjson for strings. Everything works. Done with this PR.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.

* Updating README.
  • Loading branch information
jpivarski authored Dec 13, 2019
1 parent 97ffcc4 commit e6b2906
Show file tree
Hide file tree
Showing 84 changed files with 4,287 additions and 2,085 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ set_target_properties(awkward-static PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(awkward PROPERTIES CXX_VISIBILITY_PRESET hidden)
addtest(PR016 tests/test_PR016_finish_getitem_for_rawarray.cpp)
addtest(PR019 tests/test_PR019_use_json_library.cpp)
addtest(PR030 tests/test_PR030_recordarray_in_numba.cpp)

pybind11_add_module(layout src/pyawkward.cpp)
set_target_properties(layout PROPERTIES CXX_VISIBILITY_PRESET hidden)
Expand Down
26 changes: 26 additions & 0 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Awkward 1.0

### Dependencies
- cmake
- gcc
- g++
- pytest


### Setup
- Clone the repo:
`git clone --recursive https://github.com/scikit-hep/awkward-1.0.git`

- Build awkward:
`python setup.py build`

- Test build:
`pytest -vv tests`


### Contribution
- Branch off, create a pull request - PR# used to name new tests
- Clean build dir with:
- rm -rf **/*~ **/__pycache__ build dist *.egg-info awkward1/*.so **/*.pyc
- Do this whenever:
- CMakeLists.txt changes (cpp tests must be manually included, follow existing format)
140 changes: 107 additions & 33 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION_INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.31
0.1.32
3 changes: 3 additions & 0 deletions awkward1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE

namespace = {}

import awkward1.layout
import awkward1._numba
import awkward1.highlevel
from awkward1.highlevel import Array
from awkward1.highlevel import Record
from awkward1.highlevel import FillableArray

from awkward1.operations.convert import *
from awkward1.operations.describe import *
Expand Down
6 changes: 3 additions & 3 deletions awkward1/_numba/fillable.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ def lower_beginrecord(context, builder, sig, args):
tpe, = sig.args
val, = args
proxyin = numba.cgutils.create_struct_proxy(tpe)(context, builder, value=val)
call(context, builder, libawkward.FillableArray_beginrecord, (proxyin.rawptr, context.get_constant(numba.int64, 0)))
call(context, builder, libawkward.FillableArray_beginrecord, (proxyin.rawptr,))
return context.get_dummy_value()

@numba.extending.lower_builtin("beginrecord", FillableArrayType, numba.types.StringLiteral)
def lower_beginrecord(context, builder, sig, args):
tpe, nametpe = sig.args
val, nameval = args
proxyin = numba.cgutils.create_struct_proxy(tpe)(context, builder, value=val)
name = util.globalstring(context, builder, nametpe.literal_value, inttype=numba.int64)
call(context, builder, libawkward.FillableArray_beginrecord, (proxyin.rawptr, name))
name = util.globalstring(context, builder, nametpe.literal_value)
call(context, builder, libawkward.FillableArray_beginrecord_fast, (proxyin.rawptr, name))
return context.get_dummy_value()

@numba.extending.lower_builtin("field", FillableArrayType, numba.types.StringLiteral)
Expand Down
18 changes: 16 additions & 2 deletions awkward1/_numba/libawkward.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,27 @@
FillableArray_endtuple.restype = ctypes.c_uint8
FillableArray_endtuple.numbatpe = numba.typing.ctypes_utils.make_function_type(FillableArray_endtuple)

# uint8_t awkward_FillableArray_beginrecord(void* fillablearray, int64_t disambiguator);
# uint8_t awkward_FillableArray_beginrecord(void* fillablearray);
FillableArray_beginrecord = lib.awkward_FillableArray_beginrecord
FillableArray_beginrecord.name = "FillableArray.beginrecord"
FillableArray_beginrecord.argtypes = [ctypes.c_voidp, ctypes.c_int64]
FillableArray_beginrecord.argtypes = [ctypes.c_voidp]
FillableArray_beginrecord.restype = ctypes.c_uint8
FillableArray_beginrecord.numbatpe = numba.typing.ctypes_utils.make_function_type(FillableArray_beginrecord)

# uint8_t awkward_FillableArray_beginrecord_fast(void* fillablearray, const char* name);
FillableArray_beginrecord_fast = lib.awkward_FillableArray_beginrecord_fast
FillableArray_beginrecord_fast.name = "FillableArray.beginrecord_fast"
FillableArray_beginrecord_fast.argtypes = [ctypes.c_voidp, ctypes.c_voidp]
FillableArray_beginrecord_fast.restype = ctypes.c_uint8
FillableArray_beginrecord_fast.numbatpe = numba.typing.ctypes_utils.make_function_type(FillableArray_beginrecord_fast)

# uint8_t awkward_FillableArray_beginrecord_check(void* fillablearray, const char* name);
FillableArray_beginrecord_check = lib.awkward_FillableArray_beginrecord_check
FillableArray_beginrecord_check.name = "FillableArray.beginrecord_check"
FillableArray_beginrecord_check.argtypes = [ctypes.c_voidp, ctypes.c_voidp]
FillableArray_beginrecord_check.restype = ctypes.c_uint8
FillableArray_beginrecord_check.numbatpe = numba.typing.ctypes_utils.make_function_type(FillableArray_beginrecord_check)

# uint8_t awkward_FillableArray_field_fast(void* fillablearray, const char* key);
FillableArray_field_fast = lib.awkward_FillableArray_field_fast
FillableArray_field_fast.name = "FillableArray.field_fast"
Expand Down
Loading

0 comments on commit e6b2906

Please sign in to comment.