From e31227512060b8a67cf3c204eb0ca4588c1281da Mon Sep 17 00:00:00 2001 From: Mehdi Samsami Date: Fri, 6 Jun 2025 21:20:48 +0330 Subject: [PATCH 1/5] set known first party of isort to wnb, fix line length for ruff --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2dc8f14..9fd95a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,11 +68,11 @@ allow-direct-references = true testpaths = ["tests"] filterwarnings = ["ignore"] -[tool.black] +[tool.ruff] line-length = 110 [tool.isort] atomic = true profile = "black" skip_gitignore = true -known_first_party = ["black", "blib2to3", "blackd", "_black_version"] +known_first_party = ["wnb"] From 4372f12bb395b438ce1f7f23ad5d467f7930c03c Mon Sep 17 00:00:00 2001 From: Mehdi Samsami Date: Fri, 6 Jun 2025 21:21:16 +0330 Subject: [PATCH 2/5] ignore cursor rules directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3eae1d6..f2ca833 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,4 @@ dmypy.json test.ipynb dummy.py .DS_Store +.cursor/ \ No newline at end of file From 57ad13c16aad336484f7e32fc6e0e2244a02994e Mon Sep 17 00:00:00 2001 From: Mehdi Samsami Date: Fri, 6 Jun 2025 21:22:42 +0330 Subject: [PATCH 3/5] minor update usage example in docstring --- wnb/gnb.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wnb/gnb.py b/wnb/gnb.py index dcd6c98..dbc397a 100644 --- a/wnb/gnb.py +++ b/wnb/gnb.py @@ -114,7 +114,7 @@ class GeneralNB(_BaseNB): >>> X = np.array([[-1, 1], [-2, 1], [-3, 2], [1, 1], [2, 1], [3, 2]]) >>> Y = np.array([1, 1, 1, 2, 2, 2]) >>> from wnb import GeneralNB, Distribution as D - >>> clf = GeneralNB(distributions=[D.NORMAL, D.POISSON]) + >>> clf = GeneralNB([D.NORMAL, D.POISSON]) >>> clf.fit(X, Y) GeneralNB(distributions=[, ]) @@ -200,7 +200,9 @@ def _check_X_y(self, X, y) -> tuple[np.ndarray, np.ndarray]: @staticmethod def _find_dist( - feature_idx: int, feature_name: str | None, dist_mapping: dict[DistributionLike, ColumnKey] + feature_idx: int, + feature_name: str | None, + dist_mapping: dict[DistributionLike, ColumnKey], ) -> DistributionLike: for dist, cols in dist_mapping.items(): cols_ = ( From 6151499f0f7be1a32837c7ebf25025293dfa5fb9 Mon Sep 17 00:00:00 2001 From: Mehdi Samsami Date: Fri, 6 Jun 2025 21:23:51 +0330 Subject: [PATCH 4/5] reformat the code using ruff --- wnb/_utils.py | 1 - wnb/gwnb.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/wnb/_utils.py b/wnb/_utils.py index cc9d534..2aa9f81 100644 --- a/wnb/_utils.py +++ b/wnb/_utils.py @@ -54,7 +54,6 @@ def _check_feature_names(estimator, X, *, reset): except ImportError: def _fit_context(*, prefer_skip_nested_validation: bool): - def decorator(fit_method): @functools.wraps(fit_method) def wrapper(estimator, *args: Any, **kwargs: Any): diff --git a/wnb/gwnb.py b/wnb/gwnb.py index 219bdb6..9f52ebf 100644 --- a/wnb/gwnb.py +++ b/wnb/gwnb.py @@ -250,8 +250,7 @@ def _init_parameters(self) -> None: # Ensure the size of error weights matrix matches number of classes if error_weights.shape != (self.n_classes_, self.n_classes_): raise ValueError( - "The shape of error weights matrix does not match the number of classes, " - "must be (n_classes, n_classes)." + "The shape of error weights matrix does not match the number of classes, must be (n_classes, n_classes)." ) self.error_weights_ = error_weights From 5dfda6a4d86129e335ec1807b66ace7282035308 Mon Sep 17 00:00:00 2001 From: Mehdi Samsami Date: Fri, 6 Jun 2025 21:32:52 +0330 Subject: [PATCH 5/5] set line length config for black --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9fd95a6..de39ddf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ allow-direct-references = true testpaths = ["tests"] filterwarnings = ["ignore"] -[tool.ruff] +[tool.black] line-length = 110 [tool.isort]