Skip to content

Commit 08b6e02

Browse files
authored
Merge pull request #271 from ClimateImpactLab/drop_black
Drop 'black' for 'ruff format' in CI
2 parents 0246464 + 97cb51c commit 08b6e02

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

.github/workflows/pythonpackage.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ jobs:
3232
- name: Install package
3333
run: |
3434
pip install . --no-deps
35-
- name: Format check with black
35+
- name: Format check with ruff
3636
run: |
37-
black --check .
38-
- name: Format ruff check
37+
ruff format . --diff
38+
- name: Lint check with ruff
3939
run: |
40-
ruff check .
40+
ruff check . --output-format=github
4141
4242
test:
4343
runs-on: ubuntu-latest

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ exclude = [
6565
".eggs",
6666
"docs",
6767
]
68+
69+
[tool.ruff.lint]
6870
# E402: module level import not at top of file
69-
# E501: line too long - let black worry about that
71+
# E501: line too long
7072
ignore = [
7173
"E402",
7274
"E501",

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ statsmodels==0.14.2
99
pytest==8.2.1
1010
pytest-cov==5.0.0
1111
zarr==2.18.2
12-
black==24.4.2
1312
ruff==0.4.7
1413
netcdf4==1.6.5
1514
h5netcdf==1.3.0

src/dscim/utils/rff.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ def aggregate_rff_weights(
477477
# describe and save file
478478
reweighted = reweighted.to_dataset()
479479
reweighted.attrs["version"] = 3
480-
reweighted.attrs[
481-
"description"
482-
] = """
480+
reweighted.attrs["description"] = """
483481
This set of emulator weights is generated using this script:
484482
dscim/dscim/utils/rff.py -> aggregate_rff_weights
485483
It cleans and aggregates the emulator weights csvs, linearly interpolates them between 5 year intervals, reweights them to sum to 1, and converts to ncdf4 format.
@@ -495,9 +493,7 @@ def aggregate_rff_weights(
495493
# describe and save file
496494
error_concatenated = error_concatenated.to_dataset()
497495
error_concatenated.attrs["version"] = 3
498-
error_concatenated.attrs[
499-
"description"
500-
] = """
496+
error_concatenated.attrs["description"] = """
501497
This set of emulator weight errors is generated using this script:
502498
dscim/dscim/preprocessing/rff/aggregate_rff_weights.py
503499
It cleans and aggregates the emulator weights csvs for error rows only, and converts to ncdf4 format.

src/dscim/utils/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,7 @@ def compute_damages(anomaly, betas, formula):
521521
"gmsl:anomaly"
522522
] * anomaly.temperature * anomaly.gmsl + betas[
523523
"gmsl:np.power(anomaly, 2)"
524-
] * anomaly.gmsl * np.power(
525-
anomaly.temperature, 2
526-
)
524+
] * anomaly.gmsl * np.power(anomaly.temperature, 2)
527525
elif (
528526
formula
529527
== "damages ~ -1 + anomaly + np.power(anomaly, 2) + gmsl + np.power(gmsl, 2)"

0 commit comments

Comments
 (0)