Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #446 from scikit-hep/issue-445
Browse files Browse the repository at this point in the history
Fixes #445 by not reusing a variable.
  • Loading branch information
jpivarski authored Jan 29, 2020
2 parents 29217d3 + f4afbd0 commit ced6380
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
7 changes: 0 additions & 7 deletions tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot/blob/master/LICENSE

try:
import lzma
except ImportError:
from backports import lzma
import lz4
import zstandard

import uproot

class Test(object):
Expand Down
8 changes: 4 additions & 4 deletions uproot/source/compressed.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def decompress(self, source, cursor, compressedbytes, uncompressedbytes=None):
try:
from backports.lzma import decompress as lzma_decompress
except ImportError:
raise ImportError("Install lzma package with:\n pip install backports.lzma\nor\n conda install backports.lzma\n(or just use Python >= 3.3).")
raise ImportError("install lzma package with:\n pip install backports.lzma\nor\n conda install backports.lzma\n(or just use Python >= 3.3).")
return lzma_decompress(cursor.bytes(source, compressedbytes))

elif self.algo == uproot.const.kOldCompressionAlgo:
Expand All @@ -76,7 +76,7 @@ def decompress(self, source, cursor, compressedbytes, uncompressedbytes=None):
try:
from lz4.block import decompress as lz4_decompress
except ImportError:
raise ImportError("Install lz4 package with:\n pip install lz4\nor\n conda install lz4")
raise ImportError("install lz4 package with:\n pip install lz4\nor\n conda install lz4")

if uncompressedbytes is None:
raise ValueError("lz4 needs to know the uncompressed number of bytes")
Expand All @@ -86,7 +86,7 @@ def decompress(self, source, cursor, compressedbytes, uncompressedbytes=None):
try:
import zstandard as zstd
except ImportError:
raise ImportError("Install zstd package with:\n pip install zstandard\nor\n conda install zstandard")
raise ImportError("install zstd package with:\n pip install zstandard\nor\n conda install zstandard")
dctx = zstd.ZstdDecompressor()
return dctx.decompress(cursor.bytes(source, compressedbytes))

Expand Down Expand Up @@ -141,7 +141,7 @@ def _prepare(self):
try:
import xxhash
except ImportError:
raise ImportError("Install xxhash package with:\n pip install xxhash\nor\n conda install python-xxhash")
raise ImportError("install xxhash package with:\n pip install xxhash\nor\n conda install python-xxhash")
compression = self.compression.copy(uproot.const.kLZ4)
compressedbytes -= 8
checksum = cursor.field(self._compressed, self._format_field0)
Expand Down
7 changes: 4 additions & 3 deletions uproot/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,20 +1972,21 @@ def lazyarrays(path, treepath, branches=None, namedecode="utf-8", entrysteps=flo

lazyfiles = _LazyFiles(paths, treepath, branches, entrysteps, flatten, awkward.__name__, basketcache, keycache, executor, persistvirtual, localsource, xrootdsource, httpsource, options)

brancheslist = None
for path in paths:
file = uproot.rootio.open(path, localsource=localsource, xrootdsource=xrootdsource, httpsource=httpsource, **options)
try:
tree = file[treepath]
except KeyError:
continue
branches = list(tree._normalize_branches(branches, awkward))
brancheslist = list(tree._normalize_branches(branches, awkward))
break

if branches is None:
if brancheslist is None:
raise ValueError("no matching paths contained a tree named {0}".format(repr(treepath)))

out = awkward.Table()
for branch, interpretation in branches:
for branch, interpretation in brancheslist:
inner = interpretation
while isinstance(inner, asjagged):
inner = inner.content
Expand Down
2 changes: 1 addition & 1 deletion uproot/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import re

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

Expand Down

0 comments on commit ced6380

Please sign in to comment.