From e6cedb370cd630632d13a8e1cb61901cb1c598f5 Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Tue, 24 Oct 2023 11:28:33 -0400 Subject: [PATCH] final migration --- giddy/ergodic.py | 2 +- giddy/markov.py | 16 ++++++++-------- pyproject.toml | 34 ++++++++++++---------------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/giddy/ergodic.py b/giddy/ergodic.py index b7c3dc7..d1a3858 100644 --- a/giddy/ergodic.py +++ b/giddy/ergodic.py @@ -299,7 +299,7 @@ def mfpt(P, fill_empty_classes=False): ValueError: Input transition probability matrix has 1 rows full of 0s. \ Please set fill_empty_classes=True to set diagonal elements for these \ rows to be 1 to make sure the matrix is stochastic. - """ + """ P = np.asarray(P) rows0 = (P.sum(axis=1) == 0).sum() diff --git a/giddy/markov.py b/giddy/markov.py index ca46f0b..5b1d5a8 100644 --- a/giddy/markov.py +++ b/giddy/markov.py @@ -1910,18 +1910,18 @@ def summary(self, file_name=None, title="Markov Homogeneity Test"): c = [] fmt = "r" * (k + 1) s = "\\begin{tabular}{|%s|}\\hline\n" % fmt - s += "\\multicolumn{%s}{|c|}{%s}" % (ks, title) # noqa UP031 + s += "\\multicolumn{%s}{|c|}{%s}" % (ks, title) c.append(s) s = "Number of classes: %d" % int(self.k) - c.append("\\hline\\multicolumn{%s}{|l|}{%s}" % (ks, s)) # noqa UP031 + c.append("\\hline\\multicolumn{%s}{|l|}{%s}" % (ks, s)) s = "Number of transitions: %d" % int(self.t_total) - c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) # noqa UP031 + c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) s = "Number of regimes: %d" % int(self.m) - c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) # noqa UP031 + c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) s = "Regime names: " s += ", ".join(regime_names) - c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) # noqa UP031 - s = "\\hline\\multicolumn{2}{|l}{%s}" % ("Test") # noqa UP031 + c.append("\\multicolumn{%s}{|l|}{%s}" % (ks, s)) + s = "\\hline\\multicolumn{2}{|l}{%s}" % ("Test") s += "&\\multicolumn{2}{r}{LR}&\\multicolumn{2}{r|}{Q}" c.append(s) s = "Stat." @@ -1929,11 +1929,11 @@ def summary(self, file_name=None, title="Markov Homogeneity Test"): s += "&\\multicolumn{2}{r}{%.3f}" % self.LR s += "&\\multicolumn{2}{r|}{%.3f}" % self.Q c.append(s) - s = "\\multicolumn{2}{|l}{%s}" % ("DOF") # noqa UP031 + s = "\\multicolumn{2}{|l}{%s}" % ("DOF") s += "&\\multicolumn{2}{r}{%d}" % int(self.dof) s += "&\\multicolumn{2}{r|}{%d}" % int(self.dof) c.append(s) - s = "\\multicolumn{2}{|l}{%s}" % ("p-value") # noqa UP031 + s = "\\multicolumn{2}{|l}{%s}" % ("p-value") s += "&\\multicolumn{2}{r}{%.3f}" % self.LR_p_value s += "&\\multicolumn{2}{r|}{%.3f}" % self.Q_p_value c.append(s) diff --git a/pyproject.toml b/pyproject.toml index 528edb7..0c126a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,39 +79,29 @@ select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] target-version = "py39" 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 +"__init__.py" = [ + "F401" # imported but unused ] -"giddy/ergodic.py" = [ - "N803", # Argument name should be lowercase - "N806", # Variable in function should be lowercase +"giddy/{directional,ergodic,markov,rank,sequence,util}.py" = [ + "ARG002", # Unused method argument + "N801", # Class name should use CapWords convention + "N802", # Function name should be lowercase + "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", + "B006", # Do not use mutable data structures for argument defaults + "UP031", # Use format specifiers instead of percent format ] -"giddy/rank.py" = [ - "ARG002", - "N801", - "N803", - "N806", +"giddy/{ergodic,markov,sequence}.py" = [ + "E501", # Line too long ] -"giddy/sequence.py" = ["N806"] -"giddy/util.py" = ["N803"] [tool.coverage.run] source = ["./giddy"] [tool.coverage.report] exclude_lines = [ - "if self.debug:", - "pragma: no cover", "raise NotImplementedError", "except ModuleNotFoundError:", "except ImportError",