diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71e948ae0f..ea0b36d2d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,12 +54,6 @@ repos: - id: ruff args: [--fix, --show-fixes] - id: ruff-format -- repo: https://github.com/MarcoGorelli/madforhooks - rev: 0.4.1 - hooks: - - id: no-print-statements - files: ^pymc/ - exclude: (?x)(pymc/_version.py) - repo: local hooks: - id: check-no-tests-are-ignored diff --git a/pymc/math.py b/pymc/math.py index 3aba393140..48ec0d7d2d 100644 --- a/pymc/math.py +++ b/pymc/math.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import warnings from functools import partial, reduce @@ -389,8 +388,7 @@ def perform(self, node, inputs, outputs, params=None): log_det = np.sum(np.log(np.abs(s))) z[0] = np.asarray(log_det, dtype=x.dtype) except Exception: - print(f"Failed to compute logdet of {x}.", file=sys.stdout) - raise + raise ValueError(f"Failed to compute logdet of {x}.") def grad(self, inputs, g_outputs): [gz] = g_outputs diff --git a/pymc/tuning/starting.py b/pymc/tuning/starting.py index 9f3a894ac9..c085af5d25 100644 --- a/pymc/tuning/starting.py +++ b/pymc/tuning/starting.py @@ -18,7 +18,6 @@ @author: johnsalvatier """ -import sys import warnings from collections.abc import Sequence @@ -184,7 +183,6 @@ def find_MAP( pm._log.info(e) finally: cost_func.progress.update(cost_func.task, completed=cost_func.n_eval, refresh=True) - print(file=sys.stdout) mx0 = RaveledVars(mx0, x0.point_map_info) unobserved_vars = get_default_varnames(model.unobserved_value_vars, include_transformed) diff --git a/pyproject.toml b/pyproject.toml index a5efd4b7b5..03fddead3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ extend-exclude = ["_version.py"] docstring-code-format = true [tool.ruff.lint] -select = ["C4", "D", "E", "F", "I", "UP", "W", "RUF"] +select = ["C4", "D", "E", "F", "I", "UP", "W", "RUF", "T20"] ignore = [ "E501", "F841", # Local variable name is assigned to but never used @@ -72,6 +72,12 @@ lines-between-types = 1 "I001", # Import block is un-sorted or un-formatted ] "tests/*" = ["D"] +"scripts/run_mypy.py" = [ + "T201", # No print statements +] +"*.ipynb" = [ + "T201", # No print statements +] [tool.coverage.report] exclude_lines = [ diff --git a/tests/gp/test_cov.py b/tests/gp/test_cov.py index db33502972..5a0d962747 100644 --- a/tests/gp/test_cov.py +++ b/tests/gp/test_cov.py @@ -483,7 +483,6 @@ def test_euclidean_dist(self): [1, 0, 1], ] ) - print(result, expected) npt.assert_allclose(result, expected, atol=1e-5)