Skip to content

Commit

Permalink
Updated to the new ak.Array constructor arguments in 0.4.2. (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski authored Nov 4, 2020
1 parent 28d6dd5 commit b5c0c5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions uproot4/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,15 @@ def lazy(
array_cache = _regularize_array_cache(array_cache, None)
library = uproot4.interpretation.library._regularize_library_lazy(library)

if type(array_cache) == dict:
array_cache = _WrapDict(array_cache)

if array_cache is not None:
layout_array_cache = awkward1.layout.ArrayCache(array_cache)
hold_cache = array_cache
if array_cache is not None and not isinstance(
array_cache, awkward1.layout.ArrayCache
):
if type(array_cache) is dict:
hold_cache = _WrapDict(array_cache)
if not isinstance(hold_cache, MutableMapping):
raise TypeError("array_cache must be None or a MutableMapping")
array_cache = awkward1.layout.ArrayCache(hold_cache)

real_options = dict(options)
if "num_workers" not in real_options:
Expand Down Expand Up @@ -669,7 +673,7 @@ def real_filter_branch(branch):
)
global_cache_key.append(cache_key)
virtualarray = awkward1.layout.VirtualArray(
generator, cache=layout_array_cache, cache_key=cache_key
generator, cache=array_cache, cache_key=cache_key
)
fields.append(virtualarray)
names.append(key)
Expand All @@ -679,7 +683,7 @@ def real_filter_branch(branch):
global_offsets.append(global_offsets[-1] + length)

out = awkward1.partition.IrregularlyPartitionedArray(partitions, global_offsets[1:])
return awkward1.Array(out, cache=array_cache)
return awkward1.Array(out)


class Report(object):
Expand Down
2 changes: 1 addition & 1 deletion uproot4/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import re

__version__ = "0.1.0"
__version__ = "0.1.1"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))

Expand Down

0 comments on commit b5c0c5e

Please sign in to comment.