Skip to content

Commit 6bcc105

Browse files
Update pre-commit hooks (#104)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f5b1fef commit 6bcc105

File tree

7 files changed

+46
-34
lines changed

7 files changed

+46
-34
lines changed

.pre-commit-config.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
exclude: schema/generic_schema.yaml
21
repos:
32
- repo: https://github.com/pre-commit/pre-commit-hooks
43
rev: v4.1.0
@@ -9,11 +8,21 @@ repos:
98
- id: check-json
109
- id: check-yaml
1110
- id: double-quote-string-fixer
11+
- id: debug-statements
12+
- id: mixed-line-ending
13+
14+
- repo: https://github.com/asottile/pyupgrade
15+
rev: v2.31.0
16+
hooks:
17+
- id: pyupgrade
18+
args:
19+
- '--py37-plus'
1220

1321
- repo: https://github.com/psf/black
1422
rev: 22.1.0
1523
hooks:
1624
- id: black-jupyter
25+
- id: black
1726

1827
- repo: https://github.com/keewis/blackdoc
1928
rev: v0.3.4

docs/source/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
import datetime
32

43
import ecgtools

ecgtools/parsers/cmip.py

+27-29
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,33 @@ def parse_cmip6(file):
1111
"""Parser for CMIP6"""
1212
keys = sorted(
1313
list(
14-
set(
15-
[
16-
'activity_id',
17-
'branch_method',
18-
'branch_time_in_child',
19-
'branch_time_in_parent',
20-
'experiment',
21-
'experiment_id',
22-
'frequency',
23-
'grid',
24-
'grid_label',
25-
'institution_id',
26-
'nominal_resolution',
27-
'parent_activity_id',
28-
'parent_experiment_id',
29-
'parent_source_id',
30-
'parent_time_units',
31-
'parent_variant_label',
32-
'realm',
33-
'product',
34-
'source_id',
35-
'source_type',
36-
'sub_experiment',
37-
'sub_experiment_id',
38-
'table_id',
39-
'variable_id',
40-
'variant_label',
41-
]
42-
)
14+
{
15+
'activity_id',
16+
'branch_method',
17+
'branch_time_in_child',
18+
'branch_time_in_parent',
19+
'experiment',
20+
'experiment_id',
21+
'frequency',
22+
'grid',
23+
'grid_label',
24+
'institution_id',
25+
'nominal_resolution',
26+
'parent_activity_id',
27+
'parent_experiment_id',
28+
'parent_source_id',
29+
'parent_time_units',
30+
'parent_variant_label',
31+
'realm',
32+
'product',
33+
'source_id',
34+
'source_type',
35+
'sub_experiment',
36+
'sub_experiment_id',
37+
'table_id',
38+
'variable_id',
39+
'variant_label',
40+
}
4341
)
4442
)
4543

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
line-length = 100
33
target-version = ['py38']
44
skip-string-normalization = true
5+
6+
[build-system]
7+
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]

setup.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ line_length=100
1616
skip=
1717
docs/source/conf.py
1818
setup.py
19+
20+
[tool:pytest]
21+
console_output_style = count
22+
addopts = -n auto --cov=./ --cov-report=xml --verbose

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@
4646
'version_scheme': 'post-release',
4747
'local_scheme': 'dirty-tag',
4848
},
49-
setup_requires=['setuptools_scm', 'setuptools>=30.3.0'],
5049
zip_safe=False,
5150
)

tests/test_builder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_parse_invalid_assets():
108108
b = Builder(sample_data_dir / 'cesm').build(parsing_func=parsing_func_errors)
109109

110110
assert not b.invalid_assets.empty
111-
assert set(b.invalid_assets.columns) == set([Builder.INVALID_ASSET, Builder.TRACEBACK])
111+
assert set(b.invalid_assets.columns) == {Builder.INVALID_ASSET, Builder.TRACEBACK}
112112

113113

114114
def test_save(tmp_path):
@@ -123,6 +123,6 @@ def test_save(tmp_path):
123123

124124
json_path = tmp_path / 'test_catalog.json'
125125
data = json.load(json_path.open())
126-
assert set(['catalog_file', 'assets', 'aggregation_control', 'attributes']).issubset(
126+
assert {'catalog_file', 'assets', 'aggregation_control', 'attributes'}.issubset(
127127
set(data.keys())
128128
)

0 commit comments

Comments
 (0)