Skip to content

Commit a3900cd

Browse files
committed
remove lint
1 parent 4968d29 commit a3900cd

30 files changed

+147
-146
lines changed

.github/workflows/docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
if:
2727
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
2828
github.repository
29-
29+
3030
runs-on: ubuntu-latest
31-
31+
3232
defaults:
3333
run:
3434
shell: bash -l {0}

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ repos:
3232
rev: 5.13.2
3333
hooks:
3434
- id: isort
35+
args: [--force-single-line-imports]
3536

3637
- repo: https://github.com/pre-commit/pre-commit-hooks
3738
rev: v4.5.0
@@ -46,7 +47,7 @@ repos:
4647
- id: forbid-new-submodules
4748
- id: mixed-line-ending
4849
- id: trailing-whitespace
49-
- id: name-tests-test
50+
# - id: name-tests-test
5051
- id: file-contents-sorter
5152
files: |
5253
(?x)^(

LICENSE.rst

-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
2323
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2424
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2525
OTHER DEALINGS IN THE SOFTWARE.
26-

bmi_tester/__init__.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
from importlib.metadata import version
1+
from bmi_tester._version import __version__
2+
from bmi_tester.api import check_bmi
3+
from bmi_tester.api import check_unit_is_dimensionless
4+
from bmi_tester.api import check_unit_is_time
5+
from bmi_tester.api import check_unit_is_valid
26

3-
from .api import (
4-
check_bmi,
5-
check_unit_is_dimensionless,
6-
check_unit_is_time,
7-
check_unit_is_valid,
8-
)
9-
10-
__version__ = version("bmi-tester")
117
__all__ = [
8+
"__version__",
129
"check_bmi",
1310
"check_unit_is_valid",
1411
"check_unit_is_time",

bmi_tester/_version.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.5.7.dev0"

bmi_tester/api.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import numpy as np
66
import pkg_resources
77
import pytest
8-
import six
9-
108

119
SECONDS = gimli.units.Unit("s")
1210

@@ -29,8 +27,8 @@ def check_bmi(
2927
os.environ["BMI_VERSION_STRING"] = bmi_version
3028

3129
if manifest:
32-
if isinstance(manifest, six.string_types):
33-
with open(manifest, "r") as fp:
30+
if isinstance(manifest, str):
31+
with open(manifest) as fp:
3432
manifest = fp.read()
3533
else:
3634
manifest = os.linesep.join(manifest)

bmi_tester/bmi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33

4-
class Bmi(object):
4+
class Bmi:
55
_input_var_names = ("land_surface__elevation", "land_surface_air__temperature")
66
_output_var_names = (
77
"land_surface__elevation",
@@ -22,7 +22,7 @@ def __init__(self):
2222
}
2323

2424
def initialize(self, config_file):
25-
with open(config_file, "r"):
25+
with open(config_file):
2626
pass
2727

2828
def update(self):

bmi_tester/bmipytest.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import click
1313
import pkg_resources
1414
from model_metadata import MetadataNotFoundError
15-
from model_metadata.api import query, stage
15+
from model_metadata.api import query
16+
from model_metadata.api import stage
1617
from pytest import ExitCode
1718

1819
from . import __version__
@@ -34,12 +35,12 @@ def validate_entry_point(ctx, param, value):
3435
)
3536
if not re.match(MODULE_REGEX, module_name):
3637
raise click.BadParameter(
37-
"Bad module name ({0})".format(module_name),
38+
f"Bad module name ({module_name})",
3839
param_hint="module_name:ClassName",
3940
)
4041
if not re.match(CLASS_REGEX, class_name):
4142
raise click.BadParameter(
42-
"Bad class name ({0})".format(class_name),
43+
f"Bad class name ({class_name})",
4344
param_hint="module_name:ClassName",
4445
)
4546
return value
@@ -79,7 +80,7 @@ def _tree(files):
7980

8081

8182
@click.command(
82-
context_settings=dict(ignore_unknown_options=True, allow_extra_args=True)
83+
context_settings={"ignore_unknown_options": True, "allow_extra_args": True}
8384
)
8485
@click.version_option(version=__version__)
8586
@click.option(
@@ -196,7 +197,7 @@ def main(
196197
if manifest:
197198
out(_tree(manifest))
198199
out(f"> cat {stage_dir}/{config_file}")
199-
with open(os.path.join(stage_dir, config_file), "r") as fp:
200+
with open(os.path.join(stage_dir, config_file)) as fp:
200201
out(fp.read())
201202

202203
with as_cwd(stage_dir):

bmi_tester/bootstrap/test_control.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def load_component(entry_point):
2929
else:
3030
Bmi = load_component(class_to_test)
3131

32-
INPUT_FILE = os.environ.get("BMITEST_INPUT_FILE", None)
32+
INPUT_FILE = os.environ.get("BMITEST_INPUT_FILE")
3333

3434

3535
@pytest.mark.dependency()
@@ -51,7 +51,7 @@ def test_has_finalize():
5151
)
5252
def test_initialize(tmpdir):
5353
"""Test component can initialize itself."""
54-
infile = os.environ.get("BMITEST_INPUT_FILE", None)
54+
infile = os.environ.get("BMITEST_INPUT_FILE")
5555
manifest = os.environ.get("BMITEST_MANIFEST", infile or "").splitlines()
5656

5757
with tmpdir.as_cwd() as prev:
@@ -68,7 +68,7 @@ def test_initialize(tmpdir):
6868
@pytest.mark.dependency(depends=["initialize_works"])
6969
def test_update(tmpdir):
7070
"""Test component can update itself."""
71-
infile = os.environ.get("BMITEST_INPUT_FILE", None)
71+
infile = os.environ.get("BMITEST_INPUT_FILE")
7272
manifest = os.environ.get("BMITEST_MANIFEST", infile or "").splitlines()
7373

7474
with tmpdir.as_cwd() as prev:

bmi_tester/data/udunits/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following units have been removed:
44
rem
55

66
The following units have been changed:
7-
sievert
7+
sievert
88
sverdrup
99

1010
The following units have been added:

bmi_tester/data/udunits/udunits2-accepted.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Units accepted for use with the SI
188188
<def>cGy</def>
189189
<aliases> <name><singular>rad</singular></name> </aliases>
190190
</unit>
191-
-->
191+
-->
192192
<!-- 'rem' is changed from 'cSv' since 'Sv' has been reassigned to sverdrup for CF
193193
-->
194194
<unit>

bmi_tester/data/udunits/udunits2-base.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ SI base units.
6666
6767
2. When the mole is used, the elementary entities must be specified
6868
and may be atoms, molecules, ions, electrons, other particles, or
69-
specified groups of such particles.
69+
specified groups of such particles.
7070
-->
7171
<base/>
7272
<name><singular>mole</singular></name>
@@ -85,7 +85,7 @@ SI base units.
8585
</unit>
8686
<unit>
8787
<!--
88-
sdfsdfd
88+
sdfsdfd
8989
-->
9090
<base/>
9191
<name><singular>calendar_year</singular></name>

bmi_tester/tests/stage_1/test_info.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_var_names(var_name):
1818
if standard_names.is_valid_name(var_name):
1919
standard_names.StandardName(var_name)
2020
else:
21-
warnings.warn("not a valid standard name: {name}".format(name=var_name))
21+
warnings.warn(f"not a valid standard name: {var_name}", stacklevel=2)
2222

2323

2424
@pytest.mark.dependency()
@@ -51,7 +51,7 @@ def test_get_input_var_names(initialized_bmi):
5151
n_names = initialized_bmi.get_input_var_name_count()
5252
assert len(names) == n_names
5353
else:
54-
warnings.warn("get_input_var_name_count not implemented")
54+
warnings.warn("get_input_var_name_count not implemented", stacklevel=2)
5555

5656

5757
@pytest.mark.dependency(depends=["test_output_var_name_count"])
@@ -64,4 +64,4 @@ def test_get_output_var_names(initialized_bmi):
6464
n_names = initialized_bmi.get_output_var_name_count()
6565
assert len(names) == n_names
6666
else:
67-
warnings.warn("get_output_var_name_count not implemented")
67+
warnings.warn("get_output_var_name_count not implemented", stacklevel=2)

bmi_tester/tests/stage_1/test_time.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
import pytest
77
from pytest import approx
88

9-
from bmi_tester.api import (
10-
check_unit_is_dimensionless,
11-
check_unit_is_time,
12-
check_unit_is_valid,
13-
)
9+
from bmi_tester.api import check_unit_is_dimensionless
10+
from bmi_tester.api import check_unit_is_time
11+
from bmi_tester.api import check_unit_is_valid
1412

1513

1614
@pytest.mark.dependency()

bmi_tester/tests/stage_2/test_var.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def test_get_var_type(initialized_bmi, var_name):
4949
try:
5050
np.empty(1, dtype=dtype)
5151
except TypeError:
52-
raise AssertionError(
53-
"get_var_type: bad data type name ({dtype})".format(dtype=dtype)
54-
)
52+
raise AssertionError(f"get_var_type: bad data type name ({dtype})")
5553

5654

5755
def test_get_var_units(initialized_bmi, var_name):

bmi_tester/tests/stage_3/test_grid.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from packaging.version import Version
2-
31
import numpy as np
42
import pytest
3+
from packaging.version import Version
54

6-
from ..conftest import BMI_VERSION, skip_if_grid_type_is_not
5+
from ..conftest import BMI_VERSION
6+
from ..conftest import skip_if_grid_type_is_not
77

88
VALID_GRID_TYPES = (
99
"none",
@@ -20,7 +20,7 @@
2020

2121
# @pytest.mark.dependency()
2222
def test_get_grid_rank(initialized_bmi, gid):
23-
"Test grid rank for grid {gid}".format(gid=gid)
23+
"Test grid rank for grid"
2424
rank = initialized_bmi.get_grid_rank(gid)
2525
assert isinstance(rank, int)
2626
assert rank <= 3
@@ -29,15 +29,15 @@ def test_get_grid_rank(initialized_bmi, gid):
2929

3030

3131
def test_get_grid_size(initialized_bmi, gid):
32-
"Test grid size for grid {gid}".format(gid=gid)
32+
"Test grid size for grid"
3333
size = initialized_bmi.get_grid_size(gid)
3434
assert isinstance(size, int)
3535
assert size > 0
3636

3737

3838
# @pytest.mark.dependency()
3939
def test_get_grid_type(initialized_bmi, gid):
40-
"Test grid is known for grid {gid}".format(gid=gid)
40+
"Test grid is known for grid"
4141
gtype = initialized_bmi.get_grid_type(gid)
4242
assert isinstance(gtype, str)
4343
assert gtype in VALID_GRID_TYPES
@@ -48,7 +48,7 @@ def test_get_grid_type(initialized_bmi, gid):
4848
)
4949
# @pytest.mark.dependency()
5050
def test_get_grid_node_count(initialized_bmi, gid):
51-
"Test number of nodes in grid {gid}".format(gid=gid)
51+
"Test number of nodes in grid"
5252
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
5353

5454
n_nodes = initialized_bmi.get_grid_node_count(gid)
@@ -58,7 +58,7 @@ def test_get_grid_node_count(initialized_bmi, gid):
5858

5959
# @pytest.mark.dependency()
6060
def test_get_grid_edge_count(initialized_bmi, gid):
61-
"Test number of edges in grid {gid}".format(gid=gid)
61+
"Test number of edges in grid"
6262
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
6363

6464
n_edges = initialized_bmi.get_grid_edge_count(gid)
@@ -70,7 +70,7 @@ def test_get_grid_edge_count(initialized_bmi, gid):
7070

7171
# @pytest.mark.dependency()
7272
def test_get_grid_face_count(initialized_bmi, gid):
73-
"Test number of faces in grid {gid}".format(gid=gid)
73+
"Test number of faces in grid"
7474
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
7575

7676
n_faces = initialized_bmi.get_grid_face_count(gid)
@@ -80,7 +80,7 @@ def test_get_grid_face_count(initialized_bmi, gid):
8080

8181
# @pytest.mark.dependency(depends=["test_get_grid_node_count", "test_get_grid_edge_count"])
8282
def test_get_grid_edge_nodes(initialized_bmi, gid):
83-
"Test nodes at edges for grid {gid}".format(gid=gid)
83+
"Test nodes at edges for grid"
8484
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
8585

8686
n_edges = initialized_bmi.get_grid_edge_count(gid)
@@ -100,7 +100,7 @@ def test_get_grid_edge_nodes(initialized_bmi, gid):
100100
@pytest.mark.skip("edges_per_face")
101101
# @pytest.mark.dependency(depends=["test_get_grid_node_count", "test_get_grid_edge_count", "test_get_grid_face_count"])
102102
def test_get_grid_edges_per_face(initialized_bmi, gid):
103-
"Test number of edges at each face for grid {gid}".format(gid=gid)
103+
"Test number of edges at each face for grid"
104104
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
105105

106106
n_edges = initialized_bmi.get_grid_edge_count(gid)
@@ -127,7 +127,7 @@ def test_get_grid_edges_per_face(initialized_bmi, gid):
127127
]
128128
)
129129
def test_get_grid_face_edges(initialized_bmi, gid):
130-
"Test edges at face for grid {gid}".format(gid=gid)
130+
"Test edges at face for grid"
131131
skip_if_grid_type_is_not(initialized_bmi, gid, "unstructured")
132132

133133
n_faces = initialized_bmi.get_grid_face_count(gid)

bmi_tester/tests/stage_3/test_grid_uniform_rectilinear.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_get_grid_shape(initialized_bmi, gid):
2020
try:
2121
rtn = initialized_bmi.get_grid_shape(gid, shape)
2222
except TypeError:
23-
warnings.warn("get_grid_shape should take two arguments")
23+
warnings.warn("get_grid_shape should take two arguments", stacklevel=2)
2424
rtn = initialized_bmi.get_grid_shape(gid)
2525
shape[:] = rtn
2626
else:

bmi_tester/tests/stage_3/test_value.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from packaging.version import Version
2-
31
import numpy as np
42
import pytest
3+
from packaging.version import Version
54

65
from bmi_tester.api import empty_var_buffer
76

8-
from ..conftest import BMI_VERSION_STRING, INPUT_FILE, Bmi
7+
from ..conftest import BMI_VERSION_STRING
8+
from ..conftest import INPUT_FILE
9+
from ..conftest import Bmi
910

1011
# from pytest_dependency import depends
1112

docs/_templates/links.html

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ <h3>Useful Links</h3>
44
<li><a href="https://github.com/csdms/bmi-tester/">bmi-tester @ GitHub</a></li>
55
<li><a href="https://github.com/csdms/bmi-tester/issues">Issue Tracker</a></li>
66
</ul>
7-

docs/api/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ Developer Documentation
55
:maxdepth: 2
66

77
modules
8-

docs/authors.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
.. include:: ../AUTHORS.rst
2-

docs/changelog.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
.. include:: ../CHANGES.rst
2-

0 commit comments

Comments
 (0)