From 4c69671022cd6e399080cc21ff0eb6eaff03a6e5 Mon Sep 17 00:00:00 2001 From: Simon Dirmeier Date: Thu, 29 Feb 2024 20:36:23 +0100 Subject: [PATCH] fix lints :) --- .pre-commit-config.yaml | 20 -------------- pyproject.toml | 27 +++---------------- surjectors/_src/bijectors/masked_coupling.py | 2 +- .../_src/bijectors/rq_masked_coupling.py | 2 +- surjectors/_src/conditioners/nn/made.py | 2 +- surjectors/_src/conditioners/transformer.py | 2 +- ..._masked_autoregressive_inference_funnel.py | 2 +- .../rq_masked_coupling_inference_funnel.py | 1 + 8 files changed, 9 insertions(+), 49 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d6a88e..44310c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,26 +12,6 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace -- repo: https://github.com/asottile/pyupgrade - rev: v2.29.1 - hooks: - - id: pyupgrade - args: [--py38-plus] - -- repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - args: ["--config=pyproject.toml"] - files: "(surjectors|examples)" - -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: ["--settings-path=pyproject.toml"] - files: "(surjectors|examples)" - - repo: https://github.com/pycqa/bandit rev: 1.7.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 6626ef7..eeee310 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,35 +49,15 @@ dependencies = [ [tool.hatch.envs.test] dependencies = [ - "pylint>=2.15.10", + "ruff>=0.3.0", "pytest>=7.2.0", "pytest-cov>=4.0.0" ] [tool.hatch.envs.test.scripts] -lint = 'pylint surjectors' +lint = 'ruff check surjectors' test = 'pytest -v --cov=./surjectors --cov-report=xml surjectors' -[tool.black] -line-length = 80 -extend-ignore = "E203" -target-version = ['py310'] -exclude = ''' -/( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist -)/ -''' - - [tool.isort] profile = "black" line_length = 80 @@ -98,8 +78,7 @@ exclude = ["*_test.py", "docs/**", "examples/**"] [tool.ruff.lint] select = ["E4", "E7", "E9", "F"] extend-select = [ - "UP", # pyupgrade - "D", # pydocstyle + "UP", "D", "I", "PL", "S" ] [tool.ruff.lint.pydocstyle] diff --git a/surjectors/_src/bijectors/masked_coupling.py b/surjectors/_src/bijectors/masked_coupling.py index cbb2f99..73fdd3a 100644 --- a/surjectors/_src/bijectors/masked_coupling.py +++ b/surjectors/_src/bijectors/masked_coupling.py @@ -8,7 +8,7 @@ from surjectors._src.distributions.transformed_distribution import Array -# pylint: disable=too-many-arguments, arguments-renamed +# ruff: noqa: PLR0913 class MaskedCoupling(Bijector, distrax.MaskedCoupling): """A masked coupling layer. diff --git a/surjectors/_src/bijectors/rq_masked_coupling.py b/surjectors/_src/bijectors/rq_masked_coupling.py index 6fa4db4..7bccd25 100644 --- a/surjectors/_src/bijectors/rq_masked_coupling.py +++ b/surjectors/_src/bijectors/rq_masked_coupling.py @@ -6,7 +6,7 @@ from surjectors._src.distributions.transformed_distribution import Array -# pylint: disable=too-many-arguments, arguments-renamed,too-many-ancestors +# ruff: noqa: PLR0913 class RationalQuadraticSplineMaskedCoupling(MaskedCoupling): """A rational quadratic spline masked coupling layer. diff --git a/surjectors/_src/conditioners/nn/made.py b/surjectors/_src/conditioners/nn/made.py index e2f46ea..0dc29aa 100644 --- a/surjectors/_src/conditioners/nn/made.py +++ b/surjectors/_src/conditioners/nn/made.py @@ -11,7 +11,7 @@ from surjectors._src.conditioners.nn.masked_linear import MaskedLinear -# pylint: disable=too-many-arguments, arguments-renamed +# ruff: noqa: PLR0913 class MADE(hk.Module): """Masked Autoregressive Density Estimator. diff --git a/surjectors/_src/conditioners/transformer.py b/surjectors/_src/conditioners/transformer.py index 37bd068..1967e27 100644 --- a/surjectors/_src/conditioners/transformer.py +++ b/surjectors/_src/conditioners/transformer.py @@ -64,7 +64,7 @@ def __call__(self, inputs, *, is_training=True): return hk.Linear(self.output_size)(h) -# pylint: disable=too-many-arguments +# ruff: noqa: PLR0913 def make_transformer( output_size, num_heads=4, diff --git a/surjectors/_src/surjectors/rq_masked_autoregressive_inference_funnel.py b/surjectors/_src/surjectors/rq_masked_autoregressive_inference_funnel.py index 2020265..79aa4f2 100644 --- a/surjectors/_src/surjectors/rq_masked_autoregressive_inference_funnel.py +++ b/surjectors/_src/surjectors/rq_masked_autoregressive_inference_funnel.py @@ -11,7 +11,7 @@ ) -# pylint: disable=too-many-arguments, arguments-renamed +# ruff: noqa: PLR0913 class RationalQuadraticSplineMaskedAutoregressiveInferenceFunnel( MaskedAutoregressiveInferenceFunnel ): diff --git a/surjectors/_src/surjectors/rq_masked_coupling_inference_funnel.py b/surjectors/_src/surjectors/rq_masked_coupling_inference_funnel.py index 6e025df..e61a789 100644 --- a/surjectors/_src/surjectors/rq_masked_coupling_inference_funnel.py +++ b/surjectors/_src/surjectors/rq_masked_coupling_inference_funnel.py @@ -7,6 +7,7 @@ ) +# ruff: noqa: PLR0913 class RationalQuadraticSplineMaskedCouplingInferenceFunnel( MaskedCouplingInferenceFunnel ):