Skip to content

Commit

Permalink
batch handle noqa in pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jGaboardi committed Oct 22, 2023
1 parent 86be960 commit 29924a3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion giddy/directional.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def permute(self, permutations=99, alternative="two.sided"):
else:
print("Bad option for alternative: %s." % alternative)

Check warning on line 300 in giddy/directional.py

View check run for this annotation

Codecov / codecov/patch

giddy/directional.py#L300

Added line #L300 was not covered by tests

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]
Expand Down
29 changes: 12 additions & 17 deletions giddy/markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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):
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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))

Check warning on line 1896 in giddy/markov.py

View check run for this annotation

Codecov / codecov/patch

giddy/markov.py#L1896

Added line #L1896 was not covered by tests
p0.append("&".join(line0))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions giddy/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 29924a3

Please sign in to comment.