From b6a98bf2fa4ae15458f40b76dc738bdf0a6789f4 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 31 Jan 2024 17:05:33 +0000 Subject: [PATCH] Use ruff for lint --- .pre-commit-config.yaml | 34 ++++++++------------- src/ipyoptimade/subwidgets/filter_inputs.py | 2 +- src/ipyoptimade/utils.py | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8130aa7..bbdd2a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,23 +1,15 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: - - id: check-yaml - - id: check-json - - id: trailing-whitespace - exclude: README.md - -- repo: https://github.com/ambv/black - rev: 23.12.0 - hooks: - - id: black - name: Blacken - -- repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: [--count, --show-source, --statistics] - additional_dependencies: - - flake8-bugbear==22.7.1 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-yaml + - id: check-json + - id: trailing-whitespace + exclude: README.md + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.11 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format \ No newline at end of file diff --git a/src/ipyoptimade/subwidgets/filter_inputs.py b/src/ipyoptimade/subwidgets/filter_inputs.py index eb12e0a..6b957ee 100644 --- a/src/ipyoptimade/subwidgets/filter_inputs.py +++ b/src/ipyoptimade/subwidgets/filter_inputs.py @@ -312,7 +312,7 @@ def nelements( @staticmethod def elements( - value: Tuple[bool, Dict[str, int]] + value: Tuple[bool, Dict[str, int]], ) -> Tuple[Union[List[str], List[Tuple[str]]], List[str]]: """Extract included and excluded elements""" use_all = value[0] diff --git a/src/ipyoptimade/utils.py b/src/ipyoptimade/utils.py index fe1f6ca..fcbc298 100644 --- a/src/ipyoptimade/utils.py +++ b/src/ipyoptimade/utils.py @@ -304,7 +304,7 @@ def fetch_providers(providers_urls: Union[str, List[str]] = None) -> list: def get_versioned_base_url( # pylint: disable=too-many-branches - base_url: Union[str, dict, Link, AnyUrl] + base_url: Union[str, dict, Link, AnyUrl], ) -> str: """Retrieve the versioned base URL