diff --git a/giddy/directional.py b/giddy/directional.py index 283f284..5d4b36f 100644 --- a/giddy/directional.py +++ b/giddy/directional.py @@ -299,7 +299,7 @@ def permute(self, permutations=99, alternative="two.sided"): else: print("Bad option for alternative: %s." % alternative) - def _calc(self, Y, w, k): # noqa ARG002 – Unused method argument: `k` + def _calc(self, Y, w, k): wY = weights.lag_spatial(w, Y) dx = Y[:, -1] - Y[:, 0] dy = wY[:, -1] - wY[:, 0] diff --git a/giddy/markov.py b/giddy/markov.py index ee17597..ca46f0b 100644 --- a/giddy/markov.py +++ b/giddy/markov.py @@ -301,7 +301,7 @@ def sojourn_time(self): return self._st -class Spatial_Markov: # noqa N801 – Class name should use CapWords convention +class Spatial_Markov: """ Markov transitions conditioned on the value of the spatial lag. @@ -849,7 +849,7 @@ def s(self): return self._s @property - def S(self): # noqa N802 – Function name should be lowercase + def S(self): if not hasattr(self, "_S"): _S = [] for p in self.P: @@ -865,7 +865,7 @@ def f(self): return self._f @property - def F(self): # noqa N802 – Function name should be lowercase + def F(self): if not hasattr(self, "_F"): F = np.zeros_like(self.P) for i, p in enumerate(self.P): @@ -881,23 +881,23 @@ def ht(self): return self._ht @property - def Q(self): # noqa N802 – Function name should be lowercase + def Q(self): if not hasattr(self, "_Q"): self._Q = self.ht.Q return self._Q @property - def Q_p_value(self): # noqa N802 – Function name should be lowercase + def Q_p_value(self): self._Q_p_value = self.ht.Q_p_value return self._Q_p_value @property - def LR(self): # noqa N802 – Function name should be lowercase + def LR(self): self._LR = self.ht.LR return self._LR @property - def LR_p_value(self): # noqa N802 – Function name should be lowercase + def LR_p_value(self): self._LR_p_value = self.ht.LR_p_value return self._LR_p_value @@ -1146,7 +1146,7 @@ def chi2(T1, T2): return chi2, pvalue, dof -class LISA_Markov(Markov): # noqa N801 – Class name should use CapWords convention +class LISA_Markov(Markov): """ Markov for Local Indicators of Spatial Association @@ -1726,7 +1726,7 @@ def homogeneity( ) -class Homogeneity_Results: # noqa N801 – Class name should use CapWords convention +class Homogeneity_Results: """ Wrapper class to present homogeneity results. @@ -1891,12 +1891,7 @@ def summary(self, file_name=None, title="Markov Homogeneity Test"): p0 = [] line0 = ["{s: <{w}}".format(s="P(%s)" % regime_names[r], w=col_width)] line0.extend( - - [ - "{s: >{w}}".format(s=cname, w=col_width) - for cname in self.class_names - ] - + ["{s: >{w}}".format(s=cname, w=col_width) for cname in self.class_names] ) print(" ".join(line0)) p0.append("&".join(line0)) @@ -1955,7 +1950,7 @@ def summary(self, file_name=None, title="Markov Homogeneity Test"): f.write(s1 + s2) -class FullRank_Markov(Markov): # noqa N801 – Class name should use CapWords convention +class FullRank_Markov(Markov): """ Full Rank Markov in which ranks are considered as Markov states rather than quantiles or other discretized classes. This is one way to avoid @@ -2104,7 +2099,7 @@ def sojourn_time(p, summary=True): return st -class GeoRank_Markov(Markov): # noqa N801 – Class name should use CapWords convention +class GeoRank_Markov(Markov): """ Geographic Rank Markov. Geographic units are considered as Markov states. diff --git a/giddy/rank.py b/giddy/rank.py index f574933..2b92dfc 100644 --- a/giddy/rank.py +++ b/giddy/rank.py @@ -415,7 +415,7 @@ def pseudop(sim, observed, nperm): return psim -class Tau_Local: # noqa N801 – Class name should use CapWords convention +class Tau_Local: """ Local version of the classic Tau. @@ -491,7 +491,7 @@ def __init__(self, x, y): self.tau_local = si * 1.0 / (self.n - 1) -class Tau_Local_Neighbor: # noqa N801 – Class name should use CapWords convention +class Tau_Local_Neighbor: """ Neighbor set LIMA. @@ -628,7 +628,7 @@ def __init__(self, x, y, w, permutations=0): self.tau_ln_sim = tau_ln_sim self.tau_ln_pvalues = tau_ln_pvalues - def _calc_r(self, xi, yi, xj, yj, w): # noqa ARG002 – Unused method argument: `w` + def _calc_r(self, xi, yi, xj, yj, w): dx = xi - xj dy = yi - yj dxdy = dx * dy @@ -659,7 +659,7 @@ def _calc(self, x, y, w, i=None): return tau_ln, tau_ln_weights -class Tau_Local_Neighborhood: # noqa N801 – Class name should use CapWords convention +class Tau_Local_Neighborhood: """ Neighborhood set LIMA. @@ -796,7 +796,7 @@ def __init__(self, x, y, w, permutations=0): self.tau_lnhood_pvalues = tau_lnhood_pvalues -class Tau_Regional: # noqa N801 – Class name should use CapWords convention +class Tau_Regional: """ Inter and intraregional decomposition of the classic Tau. diff --git a/pyproject.toml b/pyproject.toml index 4cbe62e..a276cea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,18 @@ ignore = [ "UP007" ] exclude = ["giddy/tests/*", "docs/*"] +[tool.ruff.per-file-ignores] +"giddy/directional.py" = [ + "ARG002", # Unused method argument +] +"giddy/markov.py" = [ + "N801", # Class name should use CapWords convention + "N802", # Function name should be lowercase +] +"giddy/rank.py" = [ + "N801", + "ARG002", +] [tool.coverage.run] source = ["./giddy"]