Skip to content

Commit

Permalink
Upgrade pre-commit versions
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 9, 2024
1 parent 2810100 commit 8a63eb9
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 14 deletions.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: no-commit-to-branch
args: ['--branch', 'master']
Expand All @@ -13,14 +13,10 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
rev: v0.6.4
hooks:
- id: ruff
args: [ --extend-select, I, --fix ]

- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- id: ruff-format

exclude: "tests/data/testensemble-reek001"
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

"""The setup script."""

from setuptools import find_packages, setup

with open("README.rst") as readme_file:
Expand Down Expand Up @@ -54,6 +55,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
test_suite="tests",
tests_require=test_requirements,
Expand Down
2 changes: 1 addition & 1 deletion src/fmu/ensemble/realizationcombination.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module for handling linear combinations of realizations. """
"""Module for handling linear combinations of realizations."""

import fnmatch
import logging
Expand Down
1 change: 1 addition & 0 deletions tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os

import yaml

from fmu.ensemble import EnsembleSet, ScratchEnsemble

logger = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions tests/test_dates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime as dt

import pytest

from fmu.ensemble.util.dates import _fallback_date_roll, date_range

# These tests are duplicated from https://github.com/equinor/res2df/blob/master/tests/test_summary.py
Expand Down
12 changes: 7 additions & 5 deletions tests/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import logging
import os

import numpy
import numpy as np
import pandas as pd
import pytest
import yaml

from fmu.ensemble import ScratchEnsemble, ScratchRealization

from .test_ensembleset import symlink_iter
Expand Down Expand Up @@ -58,7 +59,7 @@ def test_reek001(tmpdir):
assert int(statusdf.loc[4, "RMS_BATCH"]["DURATION"].values[0]) == 195

# STATUS in real4 is modified to simulate that Eclipse never finished:
assert numpy.isnan(statusdf.loc[4, "ECLIPSE100_2014.2"]["DURATION"].values[0])
assert np.isnan(statusdf.loc[4, "ECLIPSE100_2014.2"]["DURATION"].values[0])

tmpdir.chdir()
statusdf.to_csv("status.csv", index=False)
Expand Down Expand Up @@ -284,13 +285,14 @@ def test_reek001_scalars():
assert "REAL" in npv
assert "npv.txt" in npv # filename is the column name
assert len(npv) == 5
assert npv.dtypes["REAL"] == int
assert npv.dtypes["npv.txt"] == object

assert npv.dtypes["REAL"] == np.int64
assert isinstance(npv.dtypes["npv.txt"], object)
# This is undesirable, can cause trouble with aggregation
# Try again:
reekensemble.load_scalar("npv.txt", force_reread=True, convert_numeric=True)
npv = reekensemble.get_df("npv.txt")
assert npv.dtypes["npv.txt"] == int or npv.dtypes["npv.txt"] == float
assert npv.dtypes["npv.txt"] in (np.int64, np.float64)
assert len(npv) == 4 # the error should now be removed

reekensemble.load_scalar("emptyscalarfile") # missing in real-4
Expand Down
1 change: 1 addition & 0 deletions tests/test_ensemble_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pandas as pd
import pytest

from fmu.ensemble import ScratchEnsemble

logger = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions tests/test_ensemble_eclfail.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import numpy as np
import pandas as pd

from fmu.ensemble import ScratchEnsemble

logger = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions tests/test_ensemblecombination.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pandas as pd
import pytest

from fmu import ensemble

logger = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions tests/test_ensembleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import pandas as pd
import pytest

from fmu.ensemble import EnsembleSet, ScratchEnsemble

try:
Expand Down
1 change: 1 addition & 0 deletions tests/test_etc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test a deprecated submodule"""

import pytest

from fmu import ensemble


Expand Down
1 change: 1 addition & 0 deletions tests/test_observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pandas as pd
import pytest
import yaml

from fmu.ensemble import EnsembleSet, Observations, ScratchEnsemble, ScratchRealization

logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_realization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import pytest
import yaml
from dateutil.relativedelta import relativedelta
from fmu import ensemble
from resdata.summary import Summary

from fmu import ensemble

from .test_ensembleset import symlink_iter

try:
Expand Down
1 change: 1 addition & 0 deletions tests/test_realizationcombination.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os

import pytest

from fmu import ensemble
from fmu.ensemble import ScratchEnsemble

Expand Down
1 change: 1 addition & 0 deletions tests/test_res2df.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os

import pytest

from fmu.ensemble import ScratchEnsemble, ScratchRealization

HAVE_RES2DF = True
Expand Down
1 change: 1 addition & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import numpy as np
import pytest

from fmu.ensemble.util import flatten, parse_number, shortcut2path
from fmu.ensemble.util.dates import normalize_dates
from fmu.ensemble.util.rates import cumcolumn_to_ratecolumn
Expand Down
1 change: 1 addition & 0 deletions tests/test_virtualensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
import pandas as pd
import pytest

from fmu.ensemble import ScratchEnsemble, VirtualEnsemble

try:
Expand Down
1 change: 1 addition & 0 deletions tests/test_virtualrealization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import numpy as np
import pandas as pd
import pytest

from fmu import ensemble
from fmu.ensemble.virtualrealization import smry_cumulative

Expand Down

0 comments on commit 8a63eb9

Please sign in to comment.