Skip to content
Snippets Groups Projects
Commit bc847734 authored by Zineb Aly's avatar Zineb Aly
Browse files

make yapf

parent f62e97f5
No related branches found
No related tags found
Loading
Pipeline #11571 passed with warnings
...@@ -143,8 +143,7 @@ class Branch: ...@@ -143,8 +143,7 @@ class Branch:
self._branch[self._keymap[key]]._context, 6) self._branch[self._keymap[key]]._context, 6)
out = self._branch[self._keymap[key]].lazyarray( out = self._branch[self._keymap[key]].lazyarray(
interpretation=interpretation, interpretation=interpretation, basketcache=BASKET_CACHE)
basketcache=BASKET_CACHE)
if self._index_chain is not None and key in self._mapper.toawkward: if self._index_chain is not None and key in self._mapper.toawkward:
cache_key = self._mapper.name + '/' + key cache_key = self._mapper.name + '/' + key
if cache_key not in self._awkward_cache: if cache_key not in self._awkward_cache:
...@@ -159,8 +158,8 @@ class Branch: ...@@ -159,8 +158,8 @@ class Branch:
if isinstance(item, str): if isinstance(item, str):
return self.__getkey__(item) return self.__getkey__(item)
if item.__class__.__name__ == "ChunkedArray": # if item.__class__.__name__ == "ChunkedArray":
item = np.array(item) # item = np.array(item)
return self.__class__(self._tree, return self.__class__(self._tree,
self._mapper, self._mapper,
......
...@@ -59,7 +59,7 @@ def unique(array, dtype=np.int64): ...@@ -59,7 +59,7 @@ def unique(array, dtype=np.int64):
out[entry_idx] = last out[entry_idx] = last
for i in range(1, n): for i in range(1, n):
current = array[i] current = array[i]
if current == last: # shortcut for sorted arrays if current == last: # shortcut for sorted arrays
continue continue
already_present = False already_present = False
for j in range(entry_idx + 1): for j in range(entry_idx + 1):
...@@ -70,7 +70,7 @@ def unique(array, dtype=np.int64): ...@@ -70,7 +70,7 @@ def unique(array, dtype=np.int64):
entry_idx += 1 entry_idx += 1
out[entry_idx] = current out[entry_idx] = current
last = current last = current
return out[:entry_idx+1] return out[:entry_idx + 1]
@nb.jit(nopython=True) @nb.jit(nopython=True)
......
...@@ -12,7 +12,8 @@ class TestUnique(unittest.TestCase): ...@@ -12,7 +12,8 @@ class TestUnique(unittest.TestCase):
max_range = 100 max_range = 100
for i in range(23): for i in range(23):
low = np.random.randint(0, max_range) low = np.random.randint(0, max_range)
high = np.random.randint(low + 1, low + 2 + np.random.randint(max_range)) high = np.random.randint(low + 1,
low + 2 + np.random.randint(max_range))
n = np.random.randint(max_range) n = np.random.randint(max_range)
arr = np.random.randint(low, high, n).astype(dtype) arr = np.random.randint(low, high, n).astype(dtype)
np_reference = np.sort(np.unique(arr)) np_reference = np.sort(np.unique(arr))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment