From c60e8ec4f6fa263ac68dbffef333802291a462f4 Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Sat, 21 Oct 2023 21:22:36 -0400 Subject: [PATCH] handle warnings and linting more granularly --- giddy/tests/test_ergodic.py | 4 +++- pyproject.toml | 40 +++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/giddy/tests/test_ergodic.py b/giddy/tests/test_ergodic.py index e180e37..434d88d 100644 --- a/giddy/tests/test_ergodic.py +++ b/giddy/tests/test_ergodic.py @@ -1,3 +1,4 @@ +import pytest import unittest from .. import ergodic import numpy as np @@ -58,7 +59,8 @@ def test_mfpt(self): ) np.testing.assert_array_almost_equal(exp, obs) - obs = ergodic.fmpt(self.p2) + with pytest.warns(DeprecationWarning, match="fmpt is deprecated."): + obs = ergodic.fmpt(self.p2) exp = np.array( [ [2.66666667, 2.0, np.inf], diff --git a/pyproject.toml b/pyproject.toml index a276cea..fbe5ff6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,33 +77,33 @@ extend-exclude = ''' line-length = 88 select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] target-version = "py39" -ignore = [ - "B006", - "B008", - "B009", - "B010", - "C408", - "E731", - "F401", - "F403", - "N803", - "N806", - "N999", - "UP007" -] exclude = ["giddy/tests/*", "docs/*"] [tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] # imported but unused "giddy/directional.py" = [ "ARG002", # Unused method argument + "N803", # Argument name should be lowercase + "N806", # Variable in function should be lowercase +] +"giddy/ergodic.py" = [ + "N803", # Argument name should be lowercase + "N806", # Variable in function should be lowercase ] "giddy/markov.py" = [ + "B006", # Do not use mutable data structures for argument defaults "N801", # Class name should use CapWords convention "N802", # Function name should be lowercase + "N803", + "N806", ] "giddy/rank.py" = [ - "N801", "ARG002", + "N801", + "N803", + "N806", ] +"giddy/sequence.py" = ["N806"] +"giddy/util.py" = ["N803"] [tool.coverage.run] source = ["./giddy"] @@ -118,3 +118,13 @@ exclude_lines = [ ] ignore_errors = true omit = ["giddy/tests/*", "docs/conf.py"] + +[tool.pytest.ini_options] +filterwarnings = [ + "ignore:The weights matrix is not fully connected", # libpysal + "ignore:Objects based on the `Geometry` class will deprecated", # libpysa + "ignore:divide by zero encountered", + "ignore:invalid value encountered", + "ignore:numba.generated_jit is deprecated.", # numba/quantecon + "ignore:::.*quantecon.lss:19", # numba/quantecon +] \ No newline at end of file