Skip to content

Commit 945574e

Browse files
committed
Update pre-commit hooks
1 parent 8e35a31 commit 945574e

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
pre-commit:
1111
name: Lint
12-
uses: tskit-dev/.github/.github/workflows/lint.yml@v1
12+
uses: tskit-dev/.github/.github/workflows/lint.yml@v2
1313

1414
test:
1515
name: Python

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-merge-conflict
66
- id: debug-statements
@@ -14,12 +14,12 @@ repos:
1414
exclude: avl
1515
verbose: true
1616
- repo: https://github.com/asottile/reorder_python_imports
17-
rev: v3.14.0
17+
rev: v3.15.0
1818
hooks:
1919
- id: reorder-python-imports
2020
args: [ --unclassifiable-application-module=_tsinfer ]
2121
- repo: https://github.com/asottile/pyupgrade
22-
rev: v3.19.1
22+
rev: v3.20.0
2323
hooks:
2424
- id: pyupgrade
2525
args: [ --py3-plus, --py39-plus ]
@@ -29,14 +29,14 @@ repos:
2929
- id: black
3030
language_version: python3
3131
- repo: https://github.com/asottile/blacken-docs
32-
rev: 1.19.1
32+
rev: 1.20.0
3333
hooks:
3434
- id: blacken-docs
3535
args: [--skip-errors]
3636
additional_dependencies: [black==22.3.0]
3737
language_version: python3
3838
- repo: https://github.com/pycqa/flake8
39-
rev: 7.1.2
39+
rev: 7.3.0
4040
hooks:
4141
- id: flake8
4242
args: [--config=.flake8]

docs/simulation-example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ts = msprime.sim_mutations(ts, rate=1e-8, random_seed=7)
2424
ts.dump(name + "-source.trees")
2525
print(
26-
f"Simulated {ts.num_samples} samples over {seq_len/1e6} Mb:",
26+
f"Simulated {ts.num_samples} samples over {seq_len / 1e6} Mb:",
2727
f"{ts.num_trees} trees and {ts.num_sites} sites",
2828
)
2929

tests/test_inference.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,8 +1411,10 @@ def test_equivalance_many_at_once(self, tmp_path, tmpdir):
14111411
num_groupings,
14121412
2,
14131413
)
1414-
assert (tmpdir / "work" / f"ancestors_{(num_groupings//2)-1}.trees").exists()
1415-
assert (tmpdir / "work" / f"ancestors_{num_groupings-1}.trees").exists()
1414+
assert (
1415+
tmpdir / "work" / f"ancestors_{(num_groupings // 2) - 1}.trees"
1416+
).exists()
1417+
assert (tmpdir / "work" / f"ancestors_{num_groupings - 1}.trees").exists()
14161418
ts = tsinfer.match_ancestors_batch_finalise(tmpdir / "work")
14171419
ts2 = tsinfer.match_ancestors(samples, ancestors)
14181420
ts.tables.assert_equals(ts2.tables, ignore_provenance=True)

tests/test_variantdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def test_ancestral_missing_info(tmp_path, caplog):
875875
anc_state[15] = "n"
876876
with caplog.at_level(logging.INFO):
877877
vdata = tsinfer.VariantData(zarr_path, anc_state)
878-
assert f"4 sites ({4/ts.num_sites * 100 :.2f}%) were deliberately " in caplog.text
878+
assert f"4 sites ({4 / ts.num_sites * 100 :.2f}%) were deliberately " in caplog.text
879879
inf_ts = tsinfer.infer(vdata)
880880
for i, (inf_var, var) in enumerate(zip(inf_ts.variants(), ts.variants())):
881881
if i in [0, 11, 12, 15]:

tsinfer/inference.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ def match_ancestors_batch_groups(
848848
ancestors_ts = None
849849
else:
850850
ancestors_ts = tskit.load(
851-
os.path.join(work_dir, f"ancestors_{group_index_start-1}.trees")
851+
os.path.join(work_dir, f"ancestors_{group_index_start - 1}.trees")
852852
)
853853
matcher = initialize_ancestor_matcher(
854854
metadata, ancestors_ts, num_threads=num_threads
@@ -859,7 +859,7 @@ def match_ancestors_batch_groups(
859859
for group_index in range(group_index_start, group_index_end)
860860
}
861861
)
862-
path = os.path.join(work_dir, f"ancestors_{group_index_end-1}.trees")
862+
path = os.path.join(work_dir, f"ancestors_{group_index_end - 1}.trees")
863863
logger.info(f"Dumping to {path}")
864864
ts.dump(path)
865865
with open(path + ".resources", "w") as f:
@@ -898,7 +898,7 @@ def match_ancestors_batch_group_partition(work_dir, group_index, partition_index
898898

899899
with provenance.TimingAndMemory() as timing:
900900
ancestors_ts = tskit.load(
901-
os.path.join(work_dir, f"ancestors_{group_index-1}.trees")
901+
os.path.join(work_dir, f"ancestors_{group_index - 1}.trees")
902902
)
903903
matcher = initialize_ancestor_matcher(metadata, ancestors_ts)
904904
ancestors_to_match = group["partitions"][partition_index]
@@ -935,7 +935,7 @@ def match_ancestors_batch_group_finalise(work_dir, group_index):
935935
metadata = json.load(f)
936936
group = metadata["ancestor_grouping"][group_index]
937937
ancestors_ts = tskit.load(
938-
os.path.join(work_dir, f"ancestors_{group_index-1}.trees")
938+
os.path.join(work_dir, f"ancestors_{group_index - 1}.trees")
939939
)
940940
matcher = initialize_ancestor_matcher(metadata, ancestors_ts)
941941
logger.info(

0 commit comments

Comments
 (0)