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

Commit ced6380

Browse files
authored
Merge pull request #446 from scikit-hep/issue-445
Fixes #445 by not reusing a variable.
2 parents 29217d3 + f4afbd0 commit ced6380

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

tests/test_compression.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

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

5-
try:
6-
import lzma
7-
except ImportError:
8-
from backports import lzma
9-
import lz4
10-
import zstandard
11-
125
import uproot
136

147
class Test(object):

uproot/source/compressed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def decompress(self, source, cursor, compressedbytes, uncompressedbytes=None):
6666
try:
6767
from backports.lzma import decompress as lzma_decompress
6868
except ImportError:
69-
raise ImportError("Install lzma package with:\n pip install backports.lzma\nor\n conda install backports.lzma\n(or just use Python >= 3.3).")
69+
raise ImportError("install lzma package with:\n pip install backports.lzma\nor\n conda install backports.lzma\n(or just use Python >= 3.3).")
7070
return lzma_decompress(cursor.bytes(source, compressedbytes))
7171

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

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

@@ -141,7 +141,7 @@ def _prepare(self):
141141
try:
142142
import xxhash
143143
except ImportError:
144-
raise ImportError("Install xxhash package with:\n pip install xxhash\nor\n conda install python-xxhash")
144+
raise ImportError("install xxhash package with:\n pip install xxhash\nor\n conda install python-xxhash")
145145
compression = self.compression.copy(uproot.const.kLZ4)
146146
compressedbytes -= 8
147147
checksum = cursor.field(self._compressed, self._format_field0)

uproot/tree.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,20 +1972,21 @@ def lazyarrays(path, treepath, branches=None, namedecode="utf-8", entrysteps=flo
19721972

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

1975+
brancheslist = None
19751976
for path in paths:
19761977
file = uproot.rootio.open(path, localsource=localsource, xrootdsource=xrootdsource, httpsource=httpsource, **options)
19771978
try:
19781979
tree = file[treepath]
19791980
except KeyError:
19801981
continue
1981-
branches = list(tree._normalize_branches(branches, awkward))
1982+
brancheslist = list(tree._normalize_branches(branches, awkward))
19821983
break
19831984

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

19871988
out = awkward.Table()
1988-
for branch, interpretation in branches:
1989+
for branch, interpretation in brancheslist:
19891990
inner = interpretation
19901991
while isinstance(inner, asjagged):
19911992
inner = inner.content

uproot/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import re
88

9-
__version__ = "3.11.1"
9+
__version__ = "3.11.2"
1010
version = __version__
1111
version_info = tuple(re.split(r"[-\.]", __version__))
1212

0 commit comments

Comments
 (0)