Skip to content

Commit 0e7c50c

Browse files
authored
Merge pull request #1975 from braingram/update_pre-commit
Update pre commit
2 parents fd63db9 + 7ed42c0 commit 0e7c50c

File tree

11 files changed

+25
-24
lines changed

11 files changed

+25
-24
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: "asdf/(_extern||_jsonschema)/.*"
22
repos:
33

44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v5.0.0
5+
rev: v6.0.0
66
hooks:
77
- id: check-added-large-files
88
- id: check-ast
@@ -37,13 +37,13 @@ repos:
3737
- tomli
3838

3939
- repo: https://github.com/ikamensh/flynt/
40-
rev: '1.0.1'
40+
rev: '1.0.6'
4141
hooks:
4242
- id: flynt
4343
exclude: "asdf/(extern||_jsonschema)/.*"
4444

4545
- repo: https://github.com/astral-sh/ruff-pre-commit
46-
rev: 'v0.11.6'
46+
rev: 'v0.13.0'
4747
hooks:
4848
- id: ruff
4949
args: ["--fix"]
@@ -54,7 +54,7 @@ repos:
5454
- id: black
5555

5656
- repo: https://github.com/asottile/blacken-docs
57-
rev: '1.19.1'
57+
rev: '1.20.0'
5858
hooks:
5959
- id: blacken-docs
6060

asdf/_block/external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ def clear(self):
6565
def relative_uri_for_index(uri, index):
6666
# get the os-native separated path for this uri
6767
path = util._patched_urllib_parse.urlparse(uri).path
68-
dirname, filename = os.path.split(path)
68+
_, filename = os.path.split(path)
6969
filename = os.path.splitext(filename)[0] + f"{index:04d}.asdf"
7070
return filename

asdf/_commands/exploded.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def implode(input_, output=None, resolve_references=False):
6767
If `True` resolve all external references before saving.
6868
"""
6969
if output is None:
70-
base, ext = os.path.splitext(input_)
70+
base, _ = os.path.splitext(input_)
7171
output = base + "_all" + ".asdf"
7272
with asdf.open(input_) as ff:
7373
ff2 = AsdfFile(ff)
@@ -121,7 +121,7 @@ def explode(input_, output=None):
121121
The output file.
122122
"""
123123
if output is None:
124-
base, ext = os.path.splitext(input_)
124+
base, _ = os.path.splitext(input_)
125125
output = base + "_exploded" + ".asdf"
126126
with asdf.open(input_) as ff:
127127
ff.write_to(output, all_array_storage="external")

asdf/_commands/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def help_(args):
5050

5151

5252
def main_from_args(args):
53-
parser, subparsers = make_argparser()
53+
parser, _ = make_argparser()
5454

5555
args = parser.parse_args(args)
5656

asdf/_node_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def from_root_node(cls, key, root_identifier, root_node, schema=None, extension_
361361
# node is the item in the tree
362362
# We might sometimes not want to use that node directly
363363
# but instead using a different node for traversal.
364-
t_node, traversable, from_converter = _make_traversable(node, extension_manager)
364+
t_node, traversable, _ = _make_traversable(node, extension_manager)
365365
if (is_container(node) or traversable) and id(node) in seen:
366366
info = NodeSchemaInfo(
367367
key,

asdf/_tests/_block/test_io.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_write_oversized_block():
169169
data = np.ones(30, dtype="uint8")
170170
raw_fd = io.BytesIO()
171171
fd = generic_io.get_file(raw_fd, mode="rw")
172-
with pytest.raises(RuntimeError, match="Block used size.*"):
172+
with pytest.raises(RuntimeError, match=r"Block used size.*"):
173173
bio.write_block(fd, data, allocated_size=0)
174174
assert fd.tell() == 0
175175

@@ -190,7 +190,7 @@ def test_fd_not_seekable():
190190

191191
np.testing.assert_array_equal(d, data)
192192

193-
with pytest.raises(ValueError, match="write_block received offset.*"):
193+
with pytest.raises(ValueError, match=r"write_block received offset.*"):
194194
bio.write_block(fd, data, offset=0)
195195

196196

@@ -223,14 +223,14 @@ def test_read_from_closed(tmp_path):
223223
bio.write_block(fd, data, stream=True)
224224
with generic_io.get_file(fn, mode="rw") as fd:
225225
_, _, _, callback = bio.read_block(fd, offset=0, lazy_load=True)
226-
with pytest.raises(OSError, match="ASDF file has already been closed. Can not get the data."):
226+
with pytest.raises(OSError, match=r"ASDF file has already been closed\. Can not get the data\."):
227227
callback()
228228

229229

230230
@pytest.mark.parametrize("data", [np.ones(10, dtype="f4"), np.ones((3, 3), dtype="uint8")])
231231
def test_invalid_data(data):
232232
fd = generic_io.get_file(io.BytesIO(), mode="rw")
233-
with pytest.raises(ValueError, match="Data must be of.*"):
233+
with pytest.raises(ValueError, match=r"Data must be of.*"):
234234
bio.write_block(fd, data, stream=True)
235235

236236

@@ -337,7 +337,7 @@ def test_read_block_index_no_header(tmp_path):
337337
generate_block_index_file(fn, values=values, offset=0)
338338
with generic_io.get_file(fn, "r") as fd:
339339
fd.seek(len(constants.INDEX_HEADER))
340-
with pytest.raises(BlockIndexError, match="Failed to read block index.*"):
340+
with pytest.raises(BlockIndexError, match=r"Failed to read block index.*"):
341341
assert bio.read_block_index(fd) == values
342342

343343

asdf/_tests/_block/test_options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,27 @@ def test_default_compression():
6868

6969
@pytest.mark.parametrize("invalid_storage", invalid_storage_types)
7070
def test_invalid_storage_type_init(invalid_storage):
71-
with pytest.raises(ValueError, match="array_storage must be one of.*"):
71+
with pytest.raises(ValueError, match=r"array_storage must be one of.*"):
7272
Options(invalid_storage)
7373

7474

7575
@pytest.mark.parametrize("invalid_storage", invalid_storage_types)
7676
def test_invalid_storage_attr(invalid_storage):
7777
o = Options("internal")
78-
with pytest.raises(ValueError, match="array_storage must be one of.*"):
78+
with pytest.raises(ValueError, match=r"array_storage must be one of.*"):
7979
o.storage_type = invalid_storage
8080

8181

8282
@pytest.mark.parametrize("invalid_compression", invalid_compression_types)
8383
def test_invalid_compression_attr(invalid_compression):
8484
o = Options("internal")
85-
with pytest.raises(ValueError, match="Invalid compression.*"):
85+
with pytest.raises(ValueError, match=r"Invalid compression.*"):
8686
o.compression = invalid_compression
8787

8888

8989
@pytest.mark.parametrize("invalid_compression", invalid_compression_types)
9090
def test_invalid_compression_init(invalid_compression):
91-
with pytest.raises(ValueError, match="Invalid compression.*"):
91+
with pytest.raises(ValueError, match=r"Invalid compression.*"):
9292
Options("internal", invalid_compression)
9393

9494

asdf/_tests/_block/test_reader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_invalid_block_index(tmp_path, invalid_block_index):
140140
with pytest.warns(AsdfBlockIndexWarning, match="Failed to read block index"):
141141
check(read_blocks(fd, lazy_load=True))
142142
else:
143-
with pytest.raises(ValueError, match="Header size.*"):
143+
with pytest.raises(ValueError, match=r"Header size.*"):
144144
check(read_blocks(fd, lazy_load=True))
145145

146146

@@ -168,7 +168,7 @@ def test_invalid_block_in_index_with_valid_magic(tmp_path):
168168

169169
def test_closed_file(tmp_path):
170170
fn = tmp_path / "test.bin"
171-
with gen_blocks(fn=fn, with_index=True) as (fd, check):
171+
with gen_blocks(fn=fn, with_index=True) as (fd, _):
172172
blocks = read_blocks(fd, lazy_load=True)
173173
blk = blocks[1]
174174
with pytest.raises(OSError, match="Attempt to load block from closed file"):
@@ -190,7 +190,7 @@ def test_bad_checksum(validate_checksums):
190190

191191
with generic_io.get_file(buff, mode="r") as fd:
192192
if validate_checksums:
193-
with pytest.raises(ValueError, match=".* does not match given checksum"):
193+
with pytest.raises(ValueError, match=r".* does not match given checksum"):
194194
read_blocks(fd, lazy_load=False, validate_checksums=validate_checksums)[0].data
195195
else:
196196
read_blocks(fd, lazy_load=False, validate_checksums=validate_checksums)[0].data

asdf/_tests/_regtests/test_1539.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ def test_invalid_seek_and_read_from_closed_memoryio():
1717
b.seek(0)
1818
f = asdf.generic_io.get_file(b)
1919
f.close()
20-
with pytest.raises(IOError, match="I/O operation on closed file."):
20+
with pytest.raises(IOError, match=r"I/O operation on closed file\."):
2121
f.read_into_array(10)
2222
assert b.tell() == 0

asdf/_tests/test_extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ class MailboxExtension:
10371037
assert "mailbox" not in sys.modules
10381038

10391039
# as the module hasn't been loaded, the converter shouldn't be found
1040-
with pytest.raises(KeyError, match="No support available for Python type 'mailbox.Mailbox'"):
1040+
with pytest.raises(KeyError, match=r"No support available for Python type 'mailbox\.Mailbox'"):
10411041
extension_manager.get_converter_for_type(typ)
10421042

10431043
# make sure inspecting the type didn't import the module

0 commit comments

Comments
 (0)