diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 503deba..5d8825a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,42 +1,18 @@ repos: - - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.5 hooks: - - id: reorder-python-imports - language_version: python3 + - id: ruff args: - - --application-directories=.:src - - repo: https://github.com/psf/black - rev: 23.9.1 - hooks: - - id: black - args: [--safe, --quiet, --line-length, "100"] - language_version: python3 - require_serial: true - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - language_version: python3 - args: - - --max-line-length=100 - - --ignore=E128,E811,W503,W504,E203 + - '--fix' + - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - language_version: python3 - id: end-of-file-fixer - language_version: python3 - id: debug-statements - language_version: python3 - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - language_version: python3 - args: [--py3-plus, --py38-plus] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.9.0 hooks: - id: mypy diff --git a/pyproject.toml b/pyproject.toml index a1aeda8..d3c311f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,3 +71,9 @@ strict-naming = false [tool.hatch.version] source = "vcs" + +[tool.ruff] +line-length = 100 + +[tool.ruff.lint.isort] +split-on-trailing-comma = true diff --git a/src/widgetastic/types.py b/src/widgetastic/types.py index f0697a4..ac56803 100644 --- a/src/widgetastic/types.py +++ b/src/widgetastic/types.py @@ -21,8 +21,7 @@ class LocatorProtocol(Protocol): CHECK_VISIBILITY: bool - def __locator__(self) -> Union[str, Locator, WebElement]: - ... + def __locator__(self) -> Union[str, Locator, WebElement]: ... LocatorAlias = Union[str, Dict[str, str], WebElement, LocatorProtocol, "Widget"] diff --git a/src/widgetastic/utils.py b/src/widgetastic/utils.py index debab25..549a260 100644 --- a/src/widgetastic/utils.py +++ b/src/widgetastic/utils.py @@ -1,4 +1,5 @@ """This module contains some supporting classes.""" + import functools import re import string diff --git a/src/widgetastic/widget/__init__.py b/src/widgetastic/widget/__init__.py index b3f3742..d3501fd 100644 --- a/src/widgetastic/widget/__init__.py +++ b/src/widgetastic/widget/__init__.py @@ -1,4 +1,5 @@ """This module contains the base classes that are used to implement the more specific behaviour.""" + from .base import * # noqa: F403 F401 from .checkbox import Checkbox from .image import Image diff --git a/src/widgetastic/widget/base.py b/src/widgetastic/widget/base.py index 56bd323..156b184 100644 --- a/src/widgetastic/widget/base.py +++ b/src/widgetastic/widget/base.py @@ -372,9 +372,9 @@ def _get_included_widget(self, includer_id, widget_name, use_parent): for widget_includer in self._included_widgets: if widget_includer._seq_id == includer_id: parent = self if use_parent else self.parent - self._initialized_included_widgets[ - widget_includer._seq_id - ] = widget_includer.widget_class(parent, self.logger) + self._initialized_included_widgets[widget_includer._seq_id] = ( + widget_includer.widget_class(parent, self.logger) + ) break else: raise ValueError(f"Could not find includer #{includer_id}") diff --git a/src/widgetastic/widget/table.py b/src/widgetastic/widget/table.py index 036d6c0..9800a51 100644 --- a/src/widgetastic/widget/table.py +++ b/src/widgetastic/widget/table.py @@ -1,4 +1,5 @@ """This module contains the base classes that are used to implement the more specific behaviour.""" + import itertools import re from collections import defaultdict