Skip to content

Commit

Permalink
remove lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Mar 4, 2024
1 parent f2da9f2 commit 3b4dd82
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 16 deletions.
1 change: 1 addition & 0 deletions babelizer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The *babelizer*."""

from ._version import __version__

__all__ = ["__version__"]
17 changes: 9 additions & 8 deletions babelizer/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The command line interface to the babelizer."""

import fnmatch
import os
import pathlib
Expand Down Expand Up @@ -359,9 +360,7 @@ def ask_until_done(text):
}

libraries = {}
if (not prompt) or any(
[x is not None for x in (name, library, header, entry_point)]
):
if (not prompt) or any(x is not None for x in (name, library, header, entry_point)):
babelized_class = name or ask("Name of babelized class", default="<name>")
libraries[babelized_class] = {
"language": language,
Expand All @@ -385,11 +384,13 @@ def ask_until_done(text):
libraries[babelized_class] = {
"language": language,
"library": ask(f"[{babelized_class}] Name of library to babelize"),
"header": ask(
f"[{babelized_class}] Name of header file containing BMI class "
)
if language != "python"
else "__UNUSED__",
"header": (
ask(
f"[{babelized_class}] Name of header file containing BMI class "
)
if language != "python"
else "__UNUSED__"
),
"entry_point": ask(f"[{babelized_class}] Name of BMI class "),
}
if not yes("Add another library?", default=False):
Expand Down
9 changes: 7 additions & 2 deletions babelizer/metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Library metadata used by the babelizer to wrap libraries."""

import pathlib
import re
import warnings
Expand Down Expand Up @@ -142,7 +143,9 @@ def __init__(
Information about how to set up continuous integration.
"""
if plugin is not None:
warnings.warn("use 'package' instead of 'plugin'", DeprecationWarning)
warnings.warn(
"use 'package' instead of 'plugin'", DeprecationWarning, stacklevel=2
)
if package is not None:
raise ValueError("specify one of 'package' or 'plugin', not both")
package = plugin
Expand Down Expand Up @@ -295,7 +298,9 @@ def validate(config):
),
optional={},
)
warnings.warn("use 'package' instead of 'plugin'", DeprecationWarning)
warnings.warn(
"use 'package' instead of 'plugin'", DeprecationWarning, stacklevel=2
)

@staticmethod
def _handle_old_style_entry_points(library):
Expand Down
1 change: 1 addition & 0 deletions babelizer/render.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Render a new babelized project."""

import contextlib
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions babelizer/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions used by the babelizer."""

import pathlib
import subprocess
import sys
Expand Down
7 changes: 4 additions & 3 deletions docs/source/examples/heatc_ex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example of running the heatc model through its BMI."""

import numpy as np
from pymt_heatc import HeatModel

Expand Down Expand Up @@ -30,10 +31,10 @@
print(" - shape:", grid_shape)
grid_size = m.get_grid_size(grid_id)
print(" - size:", grid_size)
grid_spacing = np.empty(grid_rank, dtype=np.float)
grid_spacing = np.empty(grid_rank, dtype=np.float64)
m.get_grid_spacing(grid_id, grid_spacing)
print(" - spacing:", grid_spacing)
grid_origin = np.empty(grid_rank, dtype=np.float)
grid_origin = np.empty(grid_rank, dtype=np.float64)
m.get_grid_origin(grid_id, grid_origin)
print(" - origin:", grid_origin)
print(" - variable type:", m.get_var_type(var_name))
Expand All @@ -42,7 +43,7 @@
print(" - nbytes:", m.get_var_nbytes(var_name))

# Get the initial temperature values.
val = np.empty(grid_shape, dtype=np.float)
val = np.empty(grid_shape, dtype=np.float64)
m.get_value(var_name, val)
print(" - initial values (gridded):")
print(val.reshape(np.roll(grid_shape, 1)))
Expand Down
1 change: 1 addition & 0 deletions docs/source/examples/pymt_heatc_ex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Run the heat model in pymt."""

from pymt.models import HeatModel

# Instantiate the component and get its name.
Expand Down
6 changes: 3 additions & 3 deletions requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def requirements(extras):
if extras:
optional_dependencies = project.get("optional-dependencies", {})
for extra in extras:
dependencies[
f"[project.optional-dependencies.{extra}]"
] = optional_dependencies[extra]
dependencies[f"[project.optional-dependencies.{extra}]"] = (
optional_dependencies[extra]
)
else:
dependencies["[project.dependencies]"] = project["dependencies"]

Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the babelizer command-line interface"""

from click.testing import CliRunner

from babelizer.cli import babelize
Expand Down

0 comments on commit 3b4dd82

Please sign in to comment.