Skip to content

Commit 5ea0a1d

Browse files
authored
Merge pull request #72 from benjeffery/pre-commit
Update pre-commit
2 parents 5a5731d + 43ed26e commit 5ea0a1d

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-merge-conflict
66
- id: debug-statements
77
- id: mixed-line-ending
88
- id: check-case-conflict
99
- id: check-yaml
1010
- repo: https://github.com/asottile/reorder_python_imports
11-
rev: v2.4.0
11+
rev: v3.12.0
1212
hooks:
1313
- id: reorder-python-imports
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.12.0
15+
rev: v3.15.0
1616
hooks:
1717
- id: pyupgrade
1818
args: [--py3-plus, --py36-plus]
1919
- repo: https://github.com/psf/black
20-
rev: 20.8b1
20+
rev: 23.9.1
2121
hooks:
2222
- id: black
2323
language_version: python3
24-
- repo: https://gitlab.com/pycqa/flake8
25-
rev: 3.9.1
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 6.1.0
2626
hooks:
2727
- id: flake8
2828
args: [--config=.flake8]
29-
additional_dependencies: ["flake8-bugbear==20.1.4", "flake8-builtins==1.5.3"]
29+
additional_dependencies: ["flake8-bugbear==23.9.16", "flake8-builtins==2.1.0"]

tests/test_compression.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,36 @@ def test_int16(self):
5757
self.verify(
5858
np.int16,
5959
np.array(
60-
[2 ** 15 - 1, -(2 ** 15) + 1, 2 ** 7 + 1, -(2 ** 7) - 1], dtype=np.int64
60+
[2**15 - 1, -(2**15) + 1, 2**7 + 1, -(2**7) - 1], dtype=np.int64
6161
),
6262
)
6363

6464
def test_uint16(self):
65-
self.verify(np.uint16, np.array([256, 2 ** 16 - 1], dtype=np.uint64))
65+
self.verify(np.uint16, np.array([256, 2**16 - 1], dtype=np.uint64))
6666

6767
def test_int32(self):
6868
self.verify(
6969
np.int32,
7070
np.array(
71-
[2 ** 31 - 1, -(2 ** 31) + 1, 2 ** 15 + 1, -(2 ** 15) - 1],
71+
[2**31 - 1, -(2**31) + 1, 2**15 + 1, -(2**15) - 1],
7272
dtype=np.int64,
7373
),
7474
)
7575

7676
def test_uint32(self):
77-
self.verify(np.uint32, np.array([2 ** 16 + 1, 2 ** 32 - 1], dtype=np.uint64))
77+
self.verify(np.uint32, np.array([2**16 + 1, 2**32 - 1], dtype=np.uint64))
7878

7979
def test_int64(self):
8080
self.verify(
8181
np.int64,
8282
np.array(
83-
[2 ** 63 - 1, -(2 ** 63) + 1, 2 ** 31 + 1, -(2 ** 31) - 1],
83+
[2**63 - 1, -(2**63) + 1, 2**31 + 1, -(2**31) - 1],
8484
dtype=np.int64,
8585
),
8686
)
8787

8888
def test_uint64(self):
89-
self.verify(np.uint64, np.array([2 ** 32 + 1, 2 ** 64 - 1], dtype=np.uint64))
89+
self.verify(np.uint64, np.array([2**32 + 1, 2**64 - 1], dtype=np.uint64))
9090

9191
def test_float32(self):
9292
self.verify(np.float32, np.array([0.1, 1e-3], dtype=np.float32))

tszip/compression.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def compress(ts, destination, variants_only=False):
107107
else:
108108
# Assume that destination is a file-like object open in "wb" mode.
109109
with open(filename, "rb") as source:
110-
chunk_size = 2 ** 10 # 1MiB
110+
chunk_size = 2**10 # 1MiB
111111
for chunk in iter(functools.partial(source.read, chunk_size), b""):
112112
destination.write(chunk)
113113

@@ -167,7 +167,6 @@ def compress(self, root, compressor):
167167

168168

169169
def compress_zarr(ts, root, variants_only=False):
170-
171170
provenance_dict = provenance.get_provenance_dict({"variants_only": variants_only})
172171

173172
if variants_only:
@@ -345,12 +344,12 @@ def visitor(array):
345344

346345
arrays.sort(key=lambda x: x.nbytes_stored)
347346
max_name_len = max(len(array.name) for array in arrays)
348-
stored = [
347+
storeds = [
349348
humanize.naturalsize(array.nbytes_stored, binary=True) for array in arrays
350349
]
351-
max_stored_len = max(len(size) for size in stored)
352-
actual = [humanize.naturalsize(array.nbytes, binary=True) for array in arrays]
353-
max_actual_len = max(len(size) for size in actual)
350+
max_stored_len = max(len(size) for size in storeds)
351+
actuals = [humanize.naturalsize(array.nbytes, binary=True) for array in arrays]
352+
max_actual_len = max(len(size) for size in actuals)
354353

355354
line = "File: {}\t{}".format(
356355
path, humanize.naturalsize(os.path.getsize(path), binary=True)
@@ -372,7 +371,7 @@ def visitor(array):
372371
"ratio",
373372
)
374373
print(line)
375-
for array, stored, actual in zip(arrays, stored, actual):
374+
for array, stored, actual in zip(arrays, storeds, actuals):
376375
ratio = 0
377376
if array.nbytes > 0:
378377
ratio = array.nbytes_stored / array.nbytes

0 commit comments

Comments
 (0)