Skip to content

Commit

Permalink
update black & ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Feb 2, 2024
1 parent 6688a94 commit c0b87f0
Show file tree
Hide file tree
Showing 52 changed files with 417 additions and 269 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ files: '(screenpy_selenium|tests)/.*'
fail_fast: false
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
language_version: python3.12
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.11
rev: v0.2.0
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
583 changes: 344 additions & 239 deletions poetry.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ isort = {version = "*", optional = true}
mypy = {version = "*", optional = true}
pre-commit = {version = "*", optional = true}
pytest = {version = "*", optional = true}
ruff = {version = "*", optional = true}
ruff = {version = ">=0.2.0", optional = true}
sphinx = {version = "*", optional = true}
tox = {version = "*", optional = true}

Expand Down Expand Up @@ -107,6 +107,14 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py38" # minimum supported version
line-length = 88 # same as Black.

extend-exclude = [
"screenpy_selenium/__init__.py",
"screenpy_selenium/__version__.py",
"docs",
]

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations # coming back to this one later to compare against mypy
Expand Down Expand Up @@ -153,14 +161,7 @@ ignore = [
"ANN101", # missing self annotation, we only annotate self when we return it.
"ANN102", # missing cls annotation, we only annotate cls when we return it.
]
exclude = [
"screenpy_selenium/__init__.py",
"screenpy_selenium/__version__.py",
"docs",
]


[tool.ruff.lint]
extend-safe-fixes = [
"EM101",
"EM102",
Expand All @@ -173,7 +174,7 @@ extend-safe-fixes = [
"PT003", "PT006", "PT018",
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"D", # we don't need public-API-polished docstrings in tests.
"FBT", # using a boolean as a test object is useful!
Expand All @@ -183,22 +184,21 @@ extend-safe-fixes = [
"FA100", # we are purposely testing pacing without future annotations.
]


[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true
split-on-trailing-comma = true
known-first-party = ["screenpy_selenium", "tests"]


[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false


[tool.ruff.pycodestyle]
[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true


[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"


Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
▀▀▀▄▄ █ █▄▄▀ █▀▀ █▀▀ █ █ ░█▄▄█ █▄▄█ ▀▀▀▄▄ █▀▀ █ █▀▀ █ █ ▀█▀ █ █ █ ▀ █
░█▄▄▄█ ▀▀▀ ▀ ▀▀ ▀▀▀ ▀▀▀ ▀ ▀ ░█ ▄▄▄█ ░█▄▄▄█ ▀▀▀ ▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀ ▀ ▀
"""

try:
# importlib.metadata is present in Python 3.8 and later
import importlib.metadata as importlib_metadata # type: ignore
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/abilities/browse_the_web.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enable the actor to browse the web."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/accept_alert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Accept a javascript alert."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/chain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A meta-Action to group a series of chainable Actions together."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/clear.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Clear text from an input."""

from __future__ import annotations

from typing import Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/click.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Click on an element."""

from __future__ import annotations

from typing import Optional, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/dismiss_alert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dismiss a javascript alert."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/double_click.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Double-click on an element, or wherever the cursor currently is."""

from __future__ import annotations

from typing import Optional, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/enter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enter text into an input field, or press keys."""

from __future__ import annotations

from functools import partial
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/enter_2fa_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enter a 2-factor authentication code into a text field."""

from __future__ import annotations

from typing import Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/go_back.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Press the browser back button."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/go_forward.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Press the browser forward button."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/hold_down.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Hold down a specific key or the left mouse button, optionally on an element."""

from __future__ import annotations

import platform
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/move_mouse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Move the mouse to a specific element, or by an offset."""

from __future__ import annotations

from typing import Optional, Tuple, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/open.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Open a browser on a URL."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/pause.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pause just like in ScreenPy, but also be able to do it in a Chain!"""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/refresh_page.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Refresh the browser page."""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Release the left mouse button or a held modifier key."""

from __future__ import annotations

import platform
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/respond_to_the_prompt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Respond to a prompt."""

from __future__ import annotations

from typing import Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/right_click.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Right-click on an element, or wherever the cursor currently is."""

from __future__ import annotations

from typing import Optional, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/save_console_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Save the browser console log."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/save_screenshot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Save a screenshot."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/select.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select an item from a multi-selection field or dropdown."""

from __future__ import annotations

from typing import Optional, TypeVar, Union
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/switch_to.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Switch the driver's frame of reference."""

from __future__ import annotations

from typing import Optional, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/switch_to_tab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Switch to a specific tab or window."""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/actions/wait.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wait for the application to fulfill a given condition."""

from __future__ import annotations

from typing import Any, Callable, Iterable, Optional, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/protocols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Additional protocols for ScreenPy Selenium."""

from __future__ import annotations

from typing import Protocol, runtime_checkable
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/attribute.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate an attribute of a Target."""

from __future__ import annotations

from typing import List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/browser_title.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the title of an Actor's active browser window."""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/browser_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the current url of an Actor's browser."""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/cookies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the cookies on the Actor's web or API session."""

from __future__ import annotations

from screenpy import Actor
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate an element on the browser page."""

from __future__ import annotations

from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate one or more elements."""

from __future__ import annotations

from typing import List as ListType, Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate how many of an element are present on the page."""

from __future__ import annotations

from typing import Type, TypeVar
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/selected.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the selected option or options from a dropdown or multi-select field."""

from __future__ import annotations

from typing import List, Type, TypeVar, Union
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/text.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the text of an element or many elements."""

from __future__ import annotations

from typing import List, Type, TypeVar, Union
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/questions/text_of_the_alert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Investigate the text of an alert."""

from __future__ import annotations

from screenpy.actor import Actor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
assert_that(driver.find_element_by_id("search"), is_clickable_element())
"""

from __future__ import annotations

from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
assert_that(driver.find_element_by_id("search"), is_invisible_element())
"""

from __future__ import annotations

from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
assert_that(driver.find_element_by_id("search"), is_present_element())
"""

from __future__ import annotations

from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
assert_that(driver.find_element_by_id("search"), is_visible_element())
"""

from __future__ import annotations

from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/resolutions/is_clickable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matches a clickable WebElement."""

from __future__ import annotations

from screenpy.resolutions.base_resolution import BaseResolution
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/resolutions/is_invisible.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matches against an invisible WebElement."""

from __future__ import annotations

from screenpy.resolutions.base_resolution import BaseResolution
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/resolutions/is_present.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matches a present WebElement."""

from __future__ import annotations

from screenpy.resolutions.base_resolution import BaseResolution
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/resolutions/is_visible.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matches against a visible WebElement."""

from __future__ import annotations

from screenpy.resolutions.base_resolution import BaseResolution
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/speech_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpful tools for making good English out of ScreenPy Selenium."""

from __future__ import annotations

from selenium.webdriver.common.keys import Keys
Expand Down
1 change: 1 addition & 0 deletions screenpy_selenium/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
human-readable string will be used in logging and reporting; the locator
will be used by Actors to find elements.
"""

from __future__ import annotations

from typing import Iterator, List, Optional, Tuple, Type, TypeVar, Union
Expand Down
Loading

0 comments on commit c0b87f0

Please sign in to comment.